-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.websocket
More file actions
42 lines (29 loc) · 890 Bytes
/
Dockerfile.websocket
File metadata and controls
42 lines (29 loc) · 890 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
37
38
39
40
41
42
FROM node:20-alpine AS base
# Install global dependencies
RUN npm install -g prisma esbuild
WORKDIR /app
# Copy package files
COPY package*.json turbo.json ./
COPY pnpm-workspace.yaml* ./
# Copy all packages
COPY packages ./packages
COPY apps/ws ./apps/ws
# Install dependencies (postinstall will run prisma generate automatically)
RUN npm install --legacy-peer-deps
# Build the websocket server
WORKDIR /app/apps/ws
RUN npm install --legacy-peer-deps
RUN npm run build
# Production stage
FROM node:20-alpine AS runner
WORKDIR /app
# Copy built files and dependencies
COPY --from=base /app/apps/ws/dist ./apps/ws/dist
COPY --from=base /app/apps/ws/package.json ./apps/ws/package.json
COPY --from=base /app/node_modules ./node_modules
COPY --from=base /app/packages ./packages
WORKDIR /app/apps/ws
ENV NODE_ENV=production
ENV PORT=8080
EXPOSE 8080
CMD ["node", "dist/index.js"]