forked from AudioBitsStellar/AudioBlock_Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (26 loc) · 936 Bytes
/
Copy pathDockerfile
File metadata and controls
36 lines (26 loc) · 936 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
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Install ffmpeg (required by fluent-ffmpeg) with minimal footprint
RUN apk add --no-cache ffmpeg
# Create non-root user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# Copy only production deps
COPY package*.json ./
RUN npm ci --omit=dev && npm cache clean --force
# Copy built artifacts from builder
COPY --from=builder /app/dist ./dist
# Copy any runtime assets (migrations, seeds, etc.) if needed
COPY --from=builder /app/src ./src 2>/dev/null || true
USER appuser
EXPOSE 4000
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD node -e "require('http').get('http://localhost:4000/health/live', (r) => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"
CMD ["node", "dist/index.js"]