feat: add Supabase auth config to production Docker setup
- Pass SUPABASE_JWT_SECRET to backend in docker-compose.prod.yml - Add build args (VITE_API_URL, VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY) to Dockerfile.prod so Vite inlines them at build time - Pass build args from secrets in deploy workflow - Add build section to frontend service in docker-compose.prod.yml No GoTrue container needed in prod — Supabase Cloud hosts the auth service. The backend only needs the JWT secret to verify tokens. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
3
.github/workflows/deploy.yml
vendored
3
.github/workflows/deploy.yml
vendored
@@ -28,6 +28,9 @@ jobs:
|
|||||||
- name: Build and push frontend image
|
- name: Build and push frontend image
|
||||||
run: |
|
run: |
|
||||||
docker build --platform linux/amd64 \
|
docker build --platform linux/amd64 \
|
||||||
|
--build-arg VITE_API_URL=${{ secrets.VITE_API_URL }} \
|
||||||
|
--build-arg VITE_SUPABASE_URL=${{ secrets.VITE_SUPABASE_URL }} \
|
||||||
|
--build-arg VITE_SUPABASE_ANON_KEY=${{ secrets.VITE_SUPABASE_ANON_KEY }} \
|
||||||
-t gitea.nerdboden.de/thefurya/nuzlocke-tracker-frontend:latest \
|
-t gitea.nerdboden.de/thefurya/nuzlocke-tracker-frontend:latest \
|
||||||
-f frontend/Dockerfile.prod ./frontend
|
-f frontend/Dockerfile.prod ./frontend
|
||||||
docker push gitea.nerdboden.de/thefurya/nuzlocke-tracker-frontend:latest
|
docker push gitea.nerdboden.de/thefurya/nuzlocke-tracker-frontend:latest
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- DEBUG=false
|
- DEBUG=false
|
||||||
- DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@db:5432/nuzlocke
|
- DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@db:5432/nuzlocke
|
||||||
|
- SUPABASE_JWT_SECRET=${SUPABASE_JWT_SECRET}
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -13,6 +14,13 @@ services:
|
|||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
image: gitea.nerdboden.de/thefurya/nuzlocke-tracker-frontend:latest
|
image: gitea.nerdboden.de/thefurya/nuzlocke-tracker-frontend:latest
|
||||||
|
build:
|
||||||
|
context: ./frontend
|
||||||
|
dockerfile: Dockerfile.prod
|
||||||
|
args:
|
||||||
|
- VITE_API_URL=${VITE_API_URL}
|
||||||
|
- VITE_SUPABASE_URL=${VITE_SUPABASE_URL}
|
||||||
|
- VITE_SUPABASE_ANON_KEY=${VITE_SUPABASE_ANON_KEY}
|
||||||
ports:
|
ports:
|
||||||
- "9080:80"
|
- "9080:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ COPY package*.json ./
|
|||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
ARG VITE_API_URL
|
||||||
|
ARG VITE_SUPABASE_URL
|
||||||
|
ARG VITE_SUPABASE_ANON_KEY
|
||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Stage 2: Serve
|
# Stage 2: Serve
|
||||||
|
|||||||
Reference in New Issue
Block a user