Skip to content

Commit 99f23d3

Browse files
committed
fix: add build args for VITE_ environment variables
Vite environment variables must be available at build time, not runtime. Added ARG and ENV directives to pass VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY during Docker build.
1 parent b6831c7 commit 99f23d3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
# -----------------------------------------------------------------------------
1212
FROM node:20-alpine AS builder
1313

14+
# Build arguments for Vite environment variables
15+
ARG VITE_SUPABASE_URL
16+
ARG VITE_SUPABASE_PUBLISHABLE_KEY
17+
18+
# Set as environment variables for the build process
19+
ENV VITE_SUPABASE_URL=$VITE_SUPABASE_URL
20+
ENV VITE_SUPABASE_PUBLISHABLE_KEY=$VITE_SUPABASE_PUBLISHABLE_KEY
21+
1422
WORKDIR /app
1523

1624
# Copy package files
@@ -22,7 +30,7 @@ RUN npm ci --legacy-peer-deps
2230
# Copy source code
2331
COPY . .
2432

25-
# Build the application
33+
# Build the application (VITE_ env vars are now available)
2634
# This creates the /app/dist folder with optimized static assets
2735
RUN npm run build
2836

0 commit comments

Comments
 (0)