Prod/Dev mode

This commit is contained in:
James Pattinson
2025-11-11 16:59:58 +00:00
parent d173b13bb9
commit d42b7cb307
6 changed files with 140 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
FROM node:18-alpine
# Multi-stage Dockerfile for development and production
FROM node:18-alpine AS base
WORKDIR /app
@@ -11,8 +12,24 @@ RUN npm install
# Copy application files
COPY . .
# Expose port
# Development stage
FROM base AS development
EXPOSE 3000
# Start development server
CMD ["npm", "run", "dev"]
# Production build stage
FROM base AS build
RUN npm run build
# Production stage with Nginx
FROM nginx:alpine AS production
# Copy built files from build stage
COPY --from=build /app/dist /usr/share/nginx/html
# Copy custom nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]