From e6433e259be2d1ab70b583f5e51969bee512ed9e Mon Sep 17 00:00:00 2001 From: = <=> Date: Sat, 16 Nov 2024 17:21:38 -0800 Subject: [PATCH] Fixing filename issue --- .github/workflows/build-base-image.yml | 3 ++- .github/workflows/build-image.yml | 13 ++++++++++--- crank/settings/__init__.py | 4 ++-- crank/settings/base.py | 2 +- crank/settings/dev.py | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-base-image.yml b/.github/workflows/build-base-image.yml index b9aa6a2a..f4544ee3 100644 --- a/.github/workflows/build-base-image.yml +++ b/.github/workflows/build-base-image.yml @@ -5,10 +5,11 @@ name: Build Base Image on: push: paths: - - 'Dockerfile.base' + - 'Base.Dockerfile' - 'requirements.txt' - 'package.json' - 'package-lock.json' + - '.github/workflows/build-base-image.yml' concurrency: group: deployment diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 21f1d0ce..a866e332 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -9,8 +9,6 @@ on: - completed push: - paths: - - '.github/workflows/build-image.yml' paths-ignore: - '.github/**' - 'seeds/**' @@ -50,6 +48,14 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Set environment variables from .env-prod + id: env-vars + run: | + set -a + source .env-prod + set +a + echo "::set-output name=env_vars::$(cat .env-prod | grep -v '^#' | xargs)" + - name: Authenticate with GitHub Container Registry uses: docker/login-action@v2 with: @@ -62,4 +68,5 @@ jobs: with: context: . push: true - tags: ghcr.io/${{ github.repository }}/${{ env.SERVICE }}:${{ github.sha }} \ No newline at end of file + tags: ghcr.io/${{ github.repository }}/${{ env.SERVICE }}:${{ github.sha }} + build-args: ${{ steps.env-vars.outputs.env_vars }} \ No newline at end of file diff --git a/crank/settings/__init__.py b/crank/settings/__init__.py index 155c4cac..7a7c25db 100644 --- a/crank/settings/__init__.py +++ b/crank/settings/__init__.py @@ -4,9 +4,9 @@ # you need to set "myproject = 'prod'" as an environment variable # in your OS (on which your website is hosted) -if os.environ['ENV'] == 'prod': +if os.environ.get('ENV') == 'prod': from .prod import * -elif os.environ['ENV'] == 'staging': +elif os.environ.get('ENV') == 'staging': from .staging import * else: from .dev import * diff --git a/crank/settings/base.py b/crank/settings/base.py index 070fe932..04319cc2 100644 --- a/crank/settings/base.py +++ b/crank/settings/base.py @@ -156,7 +156,7 @@ # Set session timeout to 30 minutes SESSION_COOKIE_AGE = 1800 # 30 minutes in seconds -CACHE_MIDDLEWARE_SECONDS = int(os.environ["CACHE_TTL"]) # Timeout for cached items in seconds +CACHE_MIDDLEWARE_SECONDS = int(os.environ.get("CACHE_TTL", "60")) # Timeout for cached items in seconds REDIS_MASTER_URL = os.environ.get("REDIS_MASTER_URL", "redis://redis-master:6379/0") # Optional: To use Redis for session storage diff --git a/crank/settings/dev.py b/crank/settings/dev.py index 08b254b8..66548937 100644 --- a/crank/settings/dev.py +++ b/crank/settings/dev.py @@ -8,7 +8,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent.parent DEBUG = True -SECRET_KEY = os.environ["SECRET_KEY"] +SECRET_KEY = os.environ.get("SECRET_KEY") CPU_COUNT = multiprocessing.cpu_count() DATABASES = {