From 2947743d28c95cd92897195b06cdff65ecdd743b Mon Sep 17 00:00:00 2001 From: oliviamn Date: Wed, 28 May 2025 02:23:10 +0800 Subject: [PATCH] feat: set env --- frontend/Dockerfile | 4 +++- frontend/docker-compose.yml | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index cab0f74..5872ebf 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -12,7 +12,9 @@ RUN npm ci # Copy source code COPY . . -# Build the app +# Build the app with environment variables +ARG REACT_APP_API_BASE_URL +ENV REACT_APP_API_BASE_URL=$REACT_APP_API_BASE_URL RUN npm run build # Production stage diff --git a/frontend/docker-compose.yml b/frontend/docker-compose.yml index 7e00661..9956b93 100644 --- a/frontend/docker-compose.yml +++ b/frontend/docker-compose.yml @@ -5,14 +5,15 @@ services: build: context: . dockerfile: Dockerfile + args: + - REACT_APP_API_BASE_URL=${REACT_APP_API_BASE_URL} ports: - "80:80" env_file: - .env environment: - NODE_ENV=production - # Add your environment variables here - # - REACT_APP_API_URL=http://api.example.com + - REACT_APP_API_BASE_URL=${REACT_APP_API_BASE_URL} restart: unless-stopped networks: - app-network