From 45905cfc33a687df40f0ab2b07b5843cb745bdab Mon Sep 17 00:00:00 2001 From: EmmaLRussell Date: Mon, 12 Aug 2024 17:15:32 +0100 Subject: [PATCH] push db images --- .github/workflows/docker-e2e.yml | 11 +++-------- db/scripts/push | 6 ++++++ docker/push-branch-tag | 3 +++ docker/run | 14 +++++--------- 4 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 db/scripts/push diff --git a/.github/workflows/docker-e2e.yml b/.github/workflows/docker-e2e.yml index 13fc167f..192bc566 100644 --- a/.github/workflows/docker-e2e.yml +++ b/.github/workflows/docker-e2e.yml @@ -24,14 +24,9 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build docker images - run: ./docker/build && ./docker/db-migrate/build + run: ./docker/build && ./docker/db-migrate/build && ./db/scripts/build - name: Push SHA tag - run: ./docker/push && ./docker/db-migrate/push - - name: Set environment variables for app - run: scripts/ci/copy-env-vars-to-dot-env-file - env: - NUXT_R_API_BASE: ${{ vars.NUXT_R_API_BASE }} - # Note - non-secret variables are stored under the 'vars' context, while secrets will be stored under the 'secrets' context + run: ./docker/push && ./docker/db-migrate/push && ./db/scripts/push - name: Run service dependencies run: scripts/run-dependencies - name: Run app in docker @@ -56,5 +51,5 @@ jobs: name: playwright-report path: playwright-report/ retention-days: 30 - - name: Push branch tag + - name: Push branch tag on success run: ./docker/push-branch-tag diff --git a/db/scripts/push b/db/scripts/push new file mode 100644 index 00000000..cc6721ee --- /dev/null +++ b/db/scripts/push @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euxo pipefail +HERE=$(dirname $0) +. $HERE/common + +docker push "$DB_TAG_SHA" \ No newline at end of file diff --git a/docker/push-branch-tag b/docker/push-branch-tag index a698ffe2..0bf3efbb 100755 --- a/docker/push-branch-tag +++ b/docker/push-branch-tag @@ -6,5 +6,8 @@ HERE=$(dirname $0) docker tag "$APP_TAG_SHA" "$APP_TAG_BRANCH" docker push "$APP_TAG_BRANCH" +docker tag "$DB_TAG_SHA" "$DB_TAG_BRANCH" +docker push "$DB_TAG_BRANCH" + docker tag "$DB_MIGRATE_TAG_SHA" "$DB_MIGRATE_TAG_BRANCH" docker push "$DB_MIGRATE_TAG_BRANCH" \ No newline at end of file diff --git a/docker/run b/docker/run index 4dd19010..11369df2 100755 --- a/docker/run +++ b/docker/run @@ -3,22 +3,18 @@ set -euxo pipefail HERE=$(dirname $0) . $HERE/common +# NB SHA images for both web app and migrate images must be built before running this script + # Migrate the db - db container and other dependencies should already be running docker run --rm -d \ --name $DB_MIGRATE_IMAGE_NAME - --env DATABASE_URL=postgresql://daedalus-web-app-user:changeme@localhost:5432/daedalus-web-app + --env-file env.docker "$DB_MIGRATE_TAG_SHA" docker run --rm -d \ --name "$APP_IMAGE_NAME" \ -p 3000:3000 \ - --env DATABASE_URL=postgresql://daedalus-web-app-user:changeme@localhost:5432/daedalus-web-app - --env NUXT_R_API_BASE=http://daedalus-api:8001/ + --env-file env.docker "$APP_TAG_SHA" -# TODO: Need to have build both SHA images.. maybe roll build scripts together -# TODO: docker env file -# TODO: WAIT? - - -# TODO: build and push db container in same pattern as app and migrate containers +# TODO: docker env file \ No newline at end of file