📄
Dockerfile
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
# Multi-stage build for Stop It! game
# Stage 1: Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install ALL dependencies (including devDependencies for build)
RUN npm ci
# Copy source code
COPY . .
# Build the SvelteKit application
RUN npm run build
# Prune dev dependencies
RUN npm prune --production
# Stage 2: Production stage
FROM node:20-alpine AS runtime
WORKDIR /app
# Copy package files
COPY package*.json ./
# Copy production dependencies from builder
COPY --from=builder /app/node_modules ./node_modules
# Copy built application
COPY --from=builder /app/build ./build
# Copy server code
COPY --from=builder /app/server ./server
# Expose port 3000
EXPOSE 3000
# Set NODE_ENV to production
ENV NODE_ENV=production
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
# Start the unified server
CMD ["node", "server/index.js"]