app/Dockerfile.dev
2025-07-11 13:21:49 +00:00

41 lines
1.1 KiB
Docker

FROM node:20 as builder
WORKDIR /app
COPY package*.json ./
COPY .env.development .env.development
# First generate package-lock.json if it doesn't exist, then do clean install
RUN if [ ! -f package-lock.json ]; then npm install --package-lock-only; fi && npm ci
COPY . .
# Run build with development mode
RUN npm run build -- --mode development
FROM nginx:alpine
# Copy built files
COPY --from=builder /app/dist /usr/share/nginx/html
# Create a simple nginx configuration
RUN echo 'server { \
listen 3003; \
root /usr/share/nginx/html; \
index index.html; \
location / { \
try_files $uri $uri/ /index.html; \
expires 30d; \
add_header Cache-Control "public, no-transform"; \
} \
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ { \
expires 30d; \
add_header Cache-Control "public, no-transform"; \
} \
location ~ /\. { \
deny all; \
} \
error_page 404 /index.html; \
}' > /etc/nginx/conf.d/default.conf
# Set up permissions
RUN chown -R nginx:nginx /usr/share/nginx/html \
&& chown -R nginx:nginx /var/log/nginx
# Expose HTTP port (NPM will handle HTTPS)
EXPOSE 3003