From 4b43ab5050105cd540bcc5d508dbdb42e56ce8ee Mon Sep 17 00:00:00 2001 From: wancat Date: Sun, 10 Sep 2023 19:03:31 +0800 Subject: [PATCH] fix: add build base image in CI/CD workflow --- .github/workflows/ci_cd.yml | 8 ++++++++ docker-compose.prod.yml | 6 ++++++ docker-compose.yml | 12 ++++++------ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 5440a2e..21865a0 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -55,6 +55,14 @@ jobs: push: true tags: docker.io/${{ secrets.DOCKERHUB_USERNAME }}/linux-odyssey:app + - name: Build base image + uses: docker/build-push-action@v2 + with: + context: . + file: ./quests/Dockerfile + push: false + tags: docker.io/${{ secrets.DOCKERHUB_USERNAME }}/linux-odyssey:base + - name: Build quest helloworld uses: docker/build-push-action@v2 with: diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index e448dad..6611c98 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -40,6 +40,12 @@ services: - MONGO_PASS=user-password - MONGO_DB=odyssey-test + base: + image: lancatlin/linux-odyssey:base + build: + context: . + dockerfile: ./quests/Dockerfile + helloworld: image: lancatlin/linux-odyssey:helloworld build: diff --git a/docker-compose.yml b/docker-compose.yml index 47d371a..1a637f5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,18 +48,18 @@ services: environment: - SWAGGER_FILE=/tmp/swagger.yaml - helloworld: - image: lancatlin/linux-odyssey:helloworld - build: - context: . - dockerfile: quests/helloworld/Dockerfile - base: image: lancatlin/linux-odyssey:base build: context: . dockerfile: ./quests/Dockerfile + helloworld: + image: lancatlin/linux-odyssey:helloworld + build: + context: . + dockerfile: quests/helloworld/Dockerfile + networks: internal: players: