More attempts to fix docker

This commit is contained in:
2025-04-21 23:22:32 +02:00
parent 063877bc09
commit 2e265c08f1
17 changed files with 1567 additions and 116 deletions

29
docker/ws.Dockerfile Normal file
View File

@@ -0,0 +1,29 @@
# Dockerfile for WebSocket server only
FROM node:20-alpine
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install only production dependencies
RUN npm install --omit=dev
# Copy only the websocket server code
COPY src/websocket-server.js ./src/
# Create a non-root user and group with the node user ID
RUN addgroup -g 1001 -S nodejs && \
adduser -S -u 1001 -G nodejs nodejs
# Switch to non-root user
USER nodejs
# Set environment variables
ENV NODE_ENV=production
ENV WS_PORT=3001
# Start the WebSocket server
CMD ["node", "src/websocket-server.js"]