Wauplin HF Staff commited on
Commit
322bb27
·
verified ·
1 Parent(s): 35d6865

conditional build

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -2
Dockerfile CHANGED
@@ -3,6 +3,9 @@
3
  # =======================
4
  FROM node:22-slim AS frontend-builder
5
 
 
 
 
6
  # Install pnpm globally
7
  RUN corepack enable && corepack prepare pnpm@latest --activate
8
 
@@ -18,9 +21,15 @@ RUN pnpm install --frozen-lockfile
18
  # Copy the rest of the frontend source
19
  COPY frontend/ ./
20
 
21
- # Build frontend
22
  ENV VITE_APP_ENV=production
23
- RUN pnpm build
 
 
 
 
 
 
24
 
25
 
26
  # =======================
 
3
  # =======================
4
  FROM node:22-slim AS frontend-builder
5
 
6
+ # Accept SPACE_HOST as build argument
7
+ ARG SPACE_HOST
8
+
9
  # Install pnpm globally
10
  RUN corepack enable && corepack prepare pnpm@latest --activate
11
 
 
21
  # Copy the rest of the frontend source
22
  COPY frontend/ ./
23
 
24
+ # Build frontend with SPACE_HOST as VITE_BACKEND_URL if provided
25
  ENV VITE_APP_ENV=production
26
+ RUN if [ -n "$SPACE_HOST" ]; then \
27
+ echo "Building with SPACE_HOST: $SPACE_HOST"; \
28
+ VITE_BACKEND_URL="$SPACE_HOST" pnpm build; \
29
+ else \
30
+ echo "Building without SPACE_HOST"; \
31
+ pnpm build; \
32
+ fi
33
 
34
 
35
  # =======================