-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (35 loc) · 1004 Bytes
/
Copy pathDockerfile
File metadata and controls
50 lines (35 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Multi-stage build for GHG Monitor
FROM node:18-alpine AS builder
# Set working directory
WORKDIR /app
# Copy package files
COPY frontend/package*.json ./frontend/
COPY backend/package*.json ./backend/
# Install dependencies
RUN cd frontend && npm ci
RUN cd backend && npm ci
# Copy source code
COPY frontend/ ./frontend/
COPY backend/ ./backend/
# Build frontend
RUN cd frontend && npm run build
# Build backend
RUN cd backend && npm run build
# Production stage
FROM node:18-alpine AS production
WORKDIR /app
# Copy backend package files and install production dependencies
COPY backend/package*.json ./backend/
RUN cd backend && npm ci --only=production
# Copy built backend
COPY --from=builder /app/backend/dist ./backend/dist
# Copy built frontend
COPY --from=builder /app/frontend/dist ./frontend/dist
# Copy data directory structure
COPY data/ ./data/
# Expose port
EXPOSE 3000
# Set environment
ENV NODE_ENV=production
# Start the application
CMD ["node", "backend/dist/index.js"]