-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (41 loc) · 1.22 KB
/
Dockerfile
File metadata and controls
60 lines (41 loc) · 1.22 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
57
58
59
60
# Multi-stage build for Integram Standalone
# Stage 1: Build frontend
FROM node:20-alpine AS frontend-builder
WORKDIR /app
# Copy frontend package files
COPY package*.json ./
RUN npm ci
# Copy frontend source
COPY src/ ./src/
COPY public/ ./public/
COPY index.html ./
COPY vite.config.mjs ./
# Build frontend
RUN npm run build
# Stage 2: Setup backend
FROM node:20-alpine AS backend-setup
WORKDIR /app/backend/monolith
# Copy backend package files
COPY backend/monolith/package*.json ./
RUN npm ci --only=production
# Stage 3: Final image
FROM node:20-alpine
WORKDIR /app
# Install dependencies
RUN apk add --no-cache curl
# Copy backend from setup stage
COPY --from=backend-setup /app/backend/monolith/node_modules ./backend/monolith/node_modules
COPY backend/monolith/ ./backend/monolith/
# Copy frontend build from builder stage
COPY --from=frontend-builder /app/dist ./dist
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
# Change ownership
RUN chown -R nodejs:nodejs /app
USER nodejs
EXPOSE 3000
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1
CMD ["node", "backend/monolith/src/index.js"]