From 28a6396ac6b3e40fff1298897204f9ee167ec874 Mon Sep 17 00:00:00 2001 From: massongit Date: Sun, 15 Oct 2023 01:59:50 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E9=96=8B=E7=99=BA=E7=92=B0=E5=A2=83:=20?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=AB=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=E3=81=8C=E5=8A=A0=E3=81=88=E3=82=89=E3=82=8C=E3=81=9F=E3=82=89?= =?UTF-8?q?Docker=E3=82=A4=E3=83=A1=E3=83=BC=E3=82=B8=E3=82=92=E5=86=8D?= =?UTF-8?q?=E3=83=93=E3=83=AB=E3=83=89=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-hato-bot.yml | 4 +- README.template.md | 10 ++--- dev.base.docker-compose.yml | 13 ++++++ dev.docker-compose.yml | 62 +++++++++++++++++++++------ 4 files changed, 67 insertions(+), 22 deletions(-) create mode 100644 dev.base.docker-compose.yml diff --git a/.github/workflows/deploy-hato-bot.yml b/.github/workflows/deploy-hato-bot.yml index 333dacc335..82ff58d4c4 100644 --- a/.github/workflows/deploy-hato-bot.yml +++ b/.github/workflows/deploy-hato-bot.yml @@ -68,7 +68,7 @@ jobs: DOCKER_CONTENT_TRUST: 1 with: push: true - files: docker-compose.yml,dev.docker-compose.yml + files: docker-compose.yml,dev.base.docker-compose.yml - run: echo 'TAG_NAME=latest' >> "$GITHUB_ENV" if: ${{ github.event_name == 'release' }} - name: Build and push (build) (latest) @@ -94,7 +94,7 @@ jobs: DOCKER_CONTENT_TRUST: 1 with: push: true - files: docker-compose.yml,dev.docker-compose.yml + files: docker-compose.yml,dev.base.docker-compose.yml - name: Start docker env: DOCKER_CONTENT_TRUST: 1 diff --git a/README.template.md b/README.template.md index db338c2eb5..a8361f2f0f 100644 --- a/README.template.md +++ b/README.template.md @@ -77,7 +77,8 @@ ```sh export TAG_NAME=$(git symbolic-ref --short HEAD | sed -e "s:/:-:g") - docker compose -f docker-compose.yml -f dev.docker-compose.yml up -d --wait + docker compose -f docker-compose.yml -f dev.base.docker-compose.yml -f dev.docker-compose.yml build + docker compose -f docker-compose.yml -f dev.base.docker-compose.yml -f dev.docker-compose.yml watch ``` 7. コードの変更はdocker composeの再起動で適用できます。 @@ -87,12 +88,7 @@ docker compose restart ``` - 開発時は代わりに次のコマンドを実行します。 - - ```sh - export TAG_NAME=$(git symbolic-ref --short HEAD | sed -e "s:/:-:g") - docker compose -f docker-compose.yml -f dev.docker-compose.yml restart - ``` + 開発時は自動的にDockerイメージの再ビルドが行われ反映されます。 #### lintをかける方法 diff --git a/dev.base.docker-compose.yml b/dev.base.docker-compose.yml new file mode 100644 index 0000000000..90c9c23e7b --- /dev/null +++ b/dev.base.docker-compose.yml @@ -0,0 +1,13 @@ +--- +version: "3.8" +services: + hato-bot: + build: + cache_from: + - ghcr.io/${REPOSITORY:-dev-hato/hato-bot}/hato-bot-dev:${TAG_NAME} + - ghcr.io/${REPOSITORY:-dev-hato/hato-bot}/hato-bot-dev + - ghcr.io/${REPOSITORY:-dev-hato/hato-bot}/commit-hash:${TAG_NAME} + - ghcr.io/${REPOSITORY:-dev-hato/hato-bot}/commit-hash + args: + - ENV=dev + image: ghcr.io/${REPOSITORY:-dev-hato/hato-bot}/hato-bot-dev:${TAG_NAME} diff --git a/dev.docker-compose.yml b/dev.docker-compose.yml index df6989eb00..b0540b09c0 100644 --- a/dev.docker-compose.yml +++ b/dev.docker-compose.yml @@ -1,17 +1,53 @@ --- version: "3.8" services: + postgres: + develop: + watch: + - action: rebuild + path: ./docker-compose.yml + - action: rebuild + path: ./dev.base.docker-compose.yml + - action: rebuild + path: ./dev.docker-compose.yml + - action: rebuild + path: ./postgres/Dockerfile hato-bot: - build: - cache_from: - - ghcr.io/${REPOSITORY:-dev-hato/hato-bot}/hato-bot-dev:${TAG_NAME} - - ghcr.io/${REPOSITORY:-dev-hato/hato-bot}/hato-bot-dev - - ghcr.io/${REPOSITORY:-dev-hato/hato-bot}/commit-hash:${TAG_NAME} - - ghcr.io/${REPOSITORY:-dev-hato/hato-bot}/commit-hash - args: - - ENV=dev - image: ghcr.io/${REPOSITORY:-dev-hato/hato-bot}/hato-bot-dev:${TAG_NAME} - volumes: - - type: bind - source: . - target: /usr/src/app + develop: + watch: + - action: rebuild + path: ./docker-compose.yml + - action: rebuild + path: ./dev.base.docker-compose.yml + - action: rebuild + path: ./dev.docker-compose.yml + - action: rebuild + path: ./Dockerfile + - action: rebuild + path: ./slackbot_settings.py + - action: rebuild + path: ./Pipfile + - action: rebuild + path: ./package.json + - action: rebuild + path: ./package-lock.json + - action: rebuild + path: ./create_env.py + - action: rebuild + path: ./entrypoint.py + - action: rebuild + path: ./post_command.py + - action: rebuild + path: ./run.py + - action: rebuild + path: ./wait_db.py + - action: rebuild + path: ./library + - action: rebuild + path: ./plugins + - action: rebuild + path: ./postgres/docker-entrypoint-initdb.d + - action: rebuild + path: ./.textlintrc + - action: rebuild + path: ./commands.txt From c1c0d17213b88763a4ae9be2d49828daa6b13748 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 14 Oct 2023 17:01:21 +0000 Subject: [PATCH 2/2] =?UTF-8?q?README=E3=82=92=E6=9B=B4=E6=96=B0=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=81=82=E3=81=92=E3=81=9F=E3=82=88=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 565cbd8773..bf011ce9cf 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,8 @@ ```sh export TAG_NAME=$(git symbolic-ref --short HEAD | sed -e "s:/:-:g") - docker compose -f docker-compose.yml -f dev.docker-compose.yml up -d --wait + docker compose -f docker-compose.yml -f dev.base.docker-compose.yml -f dev.docker-compose.yml build + docker compose -f docker-compose.yml -f dev.base.docker-compose.yml -f dev.docker-compose.yml watch ``` 7. コードの変更はdocker composeの再起動で適用できます。 @@ -87,12 +88,7 @@ docker compose restart ``` - 開発時は代わりに次のコマンドを実行します。 - - ```sh - export TAG_NAME=$(git symbolic-ref --short HEAD | sed -e "s:/:-:g") - docker compose -f docker-compose.yml -f dev.docker-compose.yml restart - ``` + 開発時は自動的にDockerイメージの再ビルドが行われ反映されます。 #### lintをかける方法