-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (23 loc) · 826 Bytes
/
Dockerfile
File metadata and controls
31 lines (23 loc) · 826 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
# Multi-stage Docker build for SolBug API
FROM node:20-alpine AS builder
# Install dependencies
WORKDIR /app
COPY package*.json ./
COPY packages/ ./packages/
COPY services/api/ ./services/api/
COPY tsconfig.base.json ./
# Install and build
RUN npm ci --only=production --workspaces
RUN npm run -w services/api build
# Production image
FROM node:20-alpine AS production
WORKDIR /app
# Copy built application
COPY --from=builder /app/services/api/dist ./dist/
COPY --from=builder /app/services/api/package.json ./
COPY --from=builder /app/node_modules ./node_modules/
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:8787/health', (res) => process.exit(res.statusCode === 200 ? 0 : 1))"
EXPOSE 8787
CMD ["node", "dist/index.js"]