-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (30 loc) · 849 Bytes
/
Dockerfile
File metadata and controls
44 lines (30 loc) · 849 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
# Multi-stage build for CIN-Interface
# Stage 1: Build
FROM node:22-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY . .
# Build the application
RUN npm run build
# Stage 2: Runtime
FROM node:22-alpine
WORKDIR /app
# Copy only necessary files from builder
COPY package*.json ./
RUN npm ci --omit=dev
# Copy built artifacts
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/data ./data
# Create data directory if it doesn't exist
RUN mkdir -p data
# Expose port
EXPOSE 3000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/health', (r) => {if (r.statusCode !== 200) throw new Error(r.statusCode)})"
# Start the application
CMD ["npm", "start"]