-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (34 loc) · 937 Bytes
/
Dockerfile
File metadata and controls
48 lines (34 loc) · 937 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
# Build stage - build the client
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package.json ./
COPY client/package.json ./client/
COPY server/package.json ./server/
# Install all dependencies
RUN npm install
RUN cd client && npm install
RUN cd server && npm install
# Copy source code
COPY client/ ./client/
COPY server/ ./server/
# Build client
RUN cd client && npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Copy server package files and install production dependencies
COPY server/package.json ./server/
RUN cd server && npm install --production
# Copy server code
COPY server/ ./server/
# Copy built client from builder stage
COPY --from=builder /app/client/dist ./client/dist
# Create data directory for persistence
RUN mkdir -p /app/server/data
# Expose port
EXPOSE 3001
# Set environment variables
ENV NODE_ENV=production
# Run the server
CMD ["node", "server/index.js"]