-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
94 lines (73 loc) · 2.29 KB
/
Dockerfile
File metadata and controls
94 lines (73 loc) · 2.29 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# VITAIA Medical AI - Production Dockerfile
# Multi-stage build for optimized production image
# Stage 1: Build dependencies and application
FROM node:20-alpine AS builder
# Set working directory
WORKDIR /app
# Install system dependencies for native modules
RUN apk add --no-cache \
python3 \
make \
g++ \
cairo-dev \
jpeg-dev \
pango-dev \
musl-dev \
giflib-dev \
pixman-dev \
pangomm-dev \
libjpeg-turbo-dev \
freetype-dev
# Copy package files
COPY package*.json pnpm-lock.yaml ./
# Install pnpm
RUN npm install -g pnpm@latest
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy source code
COPY . .
# Build the application
RUN pnpm run build
# Stage 2: Production runtime
FROM node:20-alpine AS runtime
# Set working directory
WORKDIR /app
# Install only production system dependencies
RUN apk add --no-cache \
dumb-init \
curl \
ca-certificates
# Create non-root user for security
RUN addgroup -g 1001 -S vitaia && \
adduser -S vitaia -u 1001
# Copy built application from builder stage
COPY --from=builder --chown=vitaia:vitaia /app/dist ./dist
COPY --from=builder --chown=vitaia:vitaia /app/client/dist ./client/dist
COPY --from=builder --chown=vitaia:vitaia /app/package.json ./
COPY --from=builder --chown=vitaia:vitaia /app/drizzle ./drizzle
# Install only production dependencies
RUN npm install -g pnpm@latest && \
pnpm install --prod --frozen-lockfile && \
pnpm store prune && \
npm cache clean --force
# Set proper permissions
RUN chown -R vitaia:vitaia /app
# Switch to non-root user
USER vitaia
# Expose port
EXPOSE 5000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:5000/health || exit 1
# Use dumb-init to handle signals properly
ENTRYPOINT ["dumb-init", "--"]
# Start the application
CMD ["node", "dist/index.js"]
# Labels for metadata
LABEL maintainer="VITAIA Team <vitaia@medical-ai.com>"
LABEL version="1.0.0"
LABEL description="VITAIA Medical AI - Multi-Provider AI for Healthcare"
LABEL org.opencontainers.image.title="VITAIA Medical AI"
LABEL org.opencontainers.image.description="Advanced medical AI platform with multi-provider support"
LABEL org.opencontainers.image.version="1.0.0"
LABEL org.opencontainers.image.vendor="VITAIA"