fix: pass VITE_* env vars as Docker build args for client bundle
Some checks are pending
Build / build (push) Waiting to run
Deploy / deploy (push) Waiting to run
Lint & Type Check / lint (push) Waiting to run
Security Scan / semgrep (push) Waiting to run
Security Scan / dependency-check (push) Waiting to run
Test / test (18.x) (push) Waiting to run
Test / test (20.x) (push) Waiting to run

VITE_* variables are baked into the bundle at vite build time. Docker's
env_file only applies at runtime, so they were missing from the build.
Pass them as ARGs from docker-compose so the client bundle includes the
correct Supabase URL and anon key.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
AeThex 2026-04-15 02:04:25 +00:00
parent a68a2b9f8e
commit dbd980a6ec
2 changed files with 14 additions and 1 deletions

View file

@ -13,6 +13,14 @@ RUN if [ -f pnpm-lock.yaml ]; then npm install -g pnpm && pnpm install --frozen-
# Copy source code
COPY . .
# Build-time env vars (VITE_* are baked into the bundle at build time)
ARG VITE_SUPABASE_URL
ARG VITE_SUPABASE_ANON_KEY
ARG VITE_AUTHENTIK_PROVIDER
ENV VITE_SUPABASE_URL=$VITE_SUPABASE_URL
ENV VITE_SUPABASE_ANON_KEY=$VITE_SUPABASE_ANON_KEY
ENV VITE_AUTHENTIK_PROVIDER=$VITE_AUTHENTIK_PROVIDER
# Build the client so the Activity gets compiled JS (no Vite dev mode in Discord iframe)
RUN npm run build:client

View file

@ -1,6 +1,11 @@
services:
aethex-forge:
build: .
build:
context: .
args:
- VITE_SUPABASE_URL=${VITE_SUPABASE_URL}
- VITE_SUPABASE_ANON_KEY=${VITE_SUPABASE_ANON_KEY}
- VITE_AUTHENTIK_PROVIDER=${VITE_AUTHENTIK_PROVIDER}
container_name: aethex-forge
restart: unless-stopped
ports: