-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.server
More file actions
43 lines (33 loc) · 1.11 KB
/
Copy pathDockerfile.server
File metadata and controls
43 lines (33 loc) · 1.11 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
# Server-only Dockerfile for development
FROM node:22-alpine AS build
WORKDIR /app
# Copy workspace files
COPY package*.json ./
COPY shared/ ./shared/
COPY graphql-server/package*.json ./graphql-server/
RUN npm ci
# Copy source and build
COPY graphql-server/ ./graphql-server/
RUN cd graphql-server && npm run build
# Production stage
FROM node:22-alpine AS production
WORKDIR /app
# Install production dependencies
COPY package*.json ./
COPY shared/ ./shared/
COPY graphql-server/package*.json ./graphql-server/
RUN npm ci --omit=dev --ignore-scripts
# Copy built application
COPY --from=build /app/graphql-server/dist ./graphql-server/dist
COPY --from=build /app/graphql-server/src/graphql/schemas/schema.graphql ./graphql-server/dist/src/graphql/schemas/
# Install curl for health checks
RUN apk add --no-cache curl
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nhlapp -u 1001
USER nhlapp
EXPOSE 4000
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:4000/health || exit 1
CMD ["node", "graphql-server/dist/src/server.js"]