remove dev dependencies from development containers

This commit is contained in:
Zimeng Xiong
2026-02-07 09:27:39 -08:00
parent bbb23ca661
commit 06f4c0f537
8 changed files with 64 additions and 40 deletions
+1 -4
View File
@@ -7,7 +7,7 @@ WORKDIR /app/frontend
COPY frontend/package*.json ./
# Install dependencies
RUN npm ci
RUN npm ci && npm cache clean --force
# Copy source code and config files
COPY frontend/ ./
@@ -25,9 +25,6 @@ RUN npm run build
# Production stage
FROM nginx:alpine
# Install envsubst (gettext) so we can template nginx config at runtime
RUN apk add --no-cache gettext
# Copy nginx config template (will be processed at runtime)
COPY frontend/nginx.conf.template /etc/nginx/nginx.conf.template
+3 -3
View File
@@ -7,9 +7,9 @@ export BACKEND_URL="${BACKEND_URL:-backend:8000}"
echo "Configuring nginx with BACKEND_URL: ${BACKEND_URL}"
# Substitute environment variables in nginx config template
# Only substitute BACKEND_URL, preserve nginx variables like $http_upgrade
envsubst '${BACKEND_URL}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
# Replace only our custom placeholder and preserve nginx runtime vars like $http_upgrade
ESCAPED_BACKEND_URL=$(printf '%s\n' "$BACKEND_URL" | sed 's/[\/&]/\\&/g')
sed "s/__BACKEND_URL__/${ESCAPED_BACKEND_URL}/g" /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
# Validate the generated nginx configuration before starting
echo "Validating nginx configuration..."
+2 -2
View File
@@ -24,7 +24,7 @@ http {
# API and WebSocket proxy to backend
# BACKEND_URL is substituted at container startup (default: backend:8000)
location /api/ {
proxy_pass http://${BACKEND_URL}/;
proxy_pass http://__BACKEND_URL__/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
@@ -49,7 +49,7 @@ http {
# WebSocket proxy for Socket.IO
location /socket.io/ {
proxy_pass http://${BACKEND_URL}/socket.io/;
proxy_pass http://__BACKEND_URL__/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';