Skip to content

Commit 1becac1

Browse files
committed
Make VITE_BACKEND_URL configurable via env
Allow the frontend backend URL to be overridden without editing files. docker-compose.yml now injects VITE_BACKEND_URL using shell parameter expansion with a default (http://localhost:11006). The frontend Dockerfile removes the hardcoded ARG default and exports ARG as ENV so the build-arg can supply the value.
1 parent 9c3c5fb commit 1becac1

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

examples/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
build:
99
context: ./frontend
1010
args:
11-
VITE_BACKEND_URL: http://localhost:11006
11+
VITE_BACKEND_URL: ${VITE_BACKEND_URL:-http://localhost:11006}
1212
ports:
1313
- "11007:11007"
1414
depends_on:

examples/frontend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ WORKDIR /app
44
COPY package*.json ./
55
RUN npm install
66
COPY . .
7-
ARG VITE_BACKEND_URL=http://localhost:11006
7+
ARG VITE_BACKEND_URL
88
ENV VITE_BACKEND_URL=$VITE_BACKEND_URL
99
RUN npm run build
1010

0 commit comments

Comments
 (0)