-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (40 loc) · 1.23 KB
/
Dockerfile
File metadata and controls
56 lines (40 loc) · 1.23 KB
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
51
52
53
54
55
56
# Revora Backend Dockerfile
# Multi-stage build for optimized production image
# Stage 1: Build
FROM node:18-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
COPY tsconfig.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY src ./src
# Build TypeScript to JavaScript
RUN npm run build
# Stage 2: Production
FROM node:18-alpine
WORKDIR /app
# Install curl for health checks
RUN apk add --no-cache curl
# Copy package files
COPY package*.json ./
# Install production dependencies only
RUN npm ci --only=production
# Copy built application from builder stage
COPY --from=builder /app/dist ./dist
# Set environment variables
ENV NODE_ENV=production
ENV PORT=3000
# Expose application port
EXPOSE 3000
# Configure Docker health check
# - Uses GET /health endpoint as specified in requirements 7.1
# - Timeout: 5 seconds (requirement 7.4)
# - Retries: 3 attempts before marking unhealthy (requirement 7.5)
# - Interval: 30 seconds between checks (requirement 7.1)
# - HTTP 200 = healthy, HTTP 503 = unhealthy (requirements 7.2, 7.3)
HEALTHCHECK --interval=30s --timeout=5s --retries=3 --start-period=10s \
CMD curl -f http://localhost:3000/health || exit 1
# Start the application
CMD ["node", "dist/index.js"]