-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (37 loc) · 976 Bytes
/
Dockerfile
File metadata and controls
52 lines (37 loc) · 976 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
43
44
45
46
47
48
49
50
51
52
# Dockerfile for Davecodes Dashboard
# Multi-stage build for production
# Stage 1: Build the React app
FROM node:22-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
RUN npm ci
# Copy source code
COPY . .
# Build the app
RUN npm run build
# Stage 2: Production server
FROM node:22-alpine AS production
WORKDIR /app
# Copy package files for server dependencies
COPY package*.json ./
RUN npm ci --production
# Install tsx for running TypeScript
RUN npm install -g tsx
# Copy built app
COPY --from=builder /app/dist ./dist
# Copy server code
COPY server ./server
# Expose ports
EXPOSE 3000 3002
# Environment variables
ENV NODE_ENV=production
ENV PORT=3000
ENV WS_PORT=3002
# Create startup script
RUN echo '#!/bin/sh' > /app/start.sh && \
echo 'npx tsx server/ws-server.ts &' >> /app/start.sh && \
echo 'npx serve -s dist -p 3000 -l 3000' >> /app/start.sh && \
chmod +x /app/start.sh
# Start both servers
CMD ["/app/start.sh"]