From 9cb88ecd9b74eae984a3b6a1baded53d3a4b7a20 Mon Sep 17 00:00:00 2001 From: Joshua Dirga Date: Sun, 17 Nov 2024 21:06:49 -0500 Subject: [PATCH] Edited dev workflow file and dockerfile --- .github/workflows/deploy-dev.yml | 7 +++++++ Dockerfile | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 3761857..d09d50b 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -27,6 +27,13 @@ jobs: file: ./Dockerfile push: true tags: cornellappdev/uplift-dev:${{ steps.vars.outputs.sha_short }} + build-args: | + DB_PASSWORD=${{ secrets.DB_PASSWORD }} + DB_HOST=postgres + DB_NAME=${{ secrets.DB_NAME }} + DB_USERNAME=${{ secrets.DB_USERNAME }} + DB_PORT=${{ secrets.DB_PORT }} + FLASK_ENV=development - name: Remote SSH and Deploy uses: appleboy/ssh-action@master env: diff --git a/Dockerfile b/Dockerfile index 4da2df0..f359f37 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,5 +6,22 @@ COPY . . ENV MAX_CONCURRENT_PIP=4 RUN pip3 install --upgrade pip RUN pip3 install --exists-action w -r requirements.txt + +# to receive build arguments +ARG DB_PASSWORD +ARG DB_HOST +ARG DB_NAME +ARG DB_USERNAME +ARG DB_PORT +ARG FLASK_ENV + +# set env variables for build +ENV DB_PASSWORD=${DB_PASSWORD} +ENV DB_HOST=${DB_HOST} +ENV DB_NAME=${DB_NAME} +ENV DB_USERNAME=${DB_USERNAME} +ENV DB_PORT=${DB_PORT} +ENV FLASK_ENV=${FLASK_ENV} + RUN flask db upgrade CMD python3 app.py