From 45cc9627c57a8565434bd12e30ed3ae9190714eb Mon Sep 17 00:00:00 2001 From: Lucid Date: Sat, 6 Dec 2025 15:05:13 -0500 Subject: [PATCH] database url secret / env variable for ci/cd --- .github/workflows/main.yml | 4 ++++ Dockerfile | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b8a2aa..1574c85 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -53,6 +53,8 @@ jobs: context: . push: ${{ !github.event.pull_request.head.repo.fork }} tags: ${{ steps.meta.outputs.tags }} + build-args: | + API_URL=DATABASE_URL=${{ secrets.DATABASE_URL }} - name: Build and Push Latest Docker Image id: build-and-push-latest uses: docker/build-push-action@v4 @@ -61,3 +63,5 @@ jobs: context: . push: true tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:latest + build-args: | + DATABASE_URL=${{ secrets.DATABASE_URL }} diff --git a/Dockerfile b/Dockerfile index b618735..8ab681c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +ARG DATABASE_URL + # --- Stage 1: Dependencies --- FROM node:20-alpine AS dependencies RUN corepack enable @@ -8,6 +10,7 @@ RUN yarn install # --- Stage 2: Builder --- FROM node:20-alpine AS builder +ENV DATABASE_URL=${DATABASE_URL} RUN corepack enable RUN corepack prepare yarn@stable --activate WORKDIR /app @@ -18,6 +21,7 @@ RUN yarn build # --- Stage 3: Runner --- FROM node:20-alpine AS runner +ENV DATABASE_URL=$DATABASE_URL RUN corepack enable RUN corepack prepare yarn@stable --activate WORKDIR /app