feat: set env

This commit is contained in:
oliviamn 2025-05-28 02:23:10 +08:00
parent 329610088d
commit 2947743d28
2 changed files with 6 additions and 3 deletions

View File

@ -12,7 +12,9 @@ RUN npm ci
# Copy source code # Copy source code
COPY . . 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 RUN npm run build
# Production stage # Production stage

View File

@ -5,14 +5,15 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
args:
- REACT_APP_API_BASE_URL=${REACT_APP_API_BASE_URL}
ports: ports:
- "80:80" - "80:80"
env_file: env_file:
- .env - .env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
# Add your environment variables here - REACT_APP_API_BASE_URL=${REACT_APP_API_BASE_URL}
# - REACT_APP_API_URL=http://api.example.com
restart: unless-stopped restart: unless-stopped
networks: networks:
- app-network - app-network