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 . .
# 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

View File

@ -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