-
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathDockerfile.ws
More file actions
32 lines (22 loc) · 824 Bytes
/
Copy pathDockerfile.ws
File metadata and controls
32 lines (22 loc) · 824 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
# Dockerfile.ws — Lightweight WebSocket server image
# Runs ws-server.js standalone with minimal dependencies.
#
# Build: docker build -f Dockerfile.ws -t crypto-news-ws .
# Run: docker run -p 8080:8080 -e REDIS_URL=redis://redis:6379 crypto-news-ws
FROM node:25-alpine AS base
RUN apk add --no-cache wget
WORKDIR /app
# Install only the WS server dependencies (ws + redis)
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && pnpm install --prod --frozen-lockfile
COPY ws-server.js ./
# Non-root for security
RUN addgroup -S wsgroup && adduser -S wsuser -G wsgroup
USER wsuser
ENV NODE_ENV=production
ENV PORT=8080
ENV WS_HEALTH_PORT=8081
EXPOSE 8080 8081
HEALTHCHECK --interval=15s --timeout=5s --retries=3 \
CMD wget --spider -q http://localhost:8080/health || exit 1
CMD ["node", "ws-server.js"]