-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (26 loc) · 1017 Bytes
/
Copy pathDockerfile
File metadata and controls
36 lines (26 loc) · 1017 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
# Use an official Node.js v20 runtime as a parent image
FROM node:20-alpine
# Set the working directory in the container
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm
# Copy root package manifest and lockfile
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
# Copy client and server package manifests
# This helps pnpm understand the workspace structure implicitly
COPY client/package.json ./client/
COPY server/package.json ./server/
# Install all dependencies (root, client, server) using pnpm
RUN pnpm install --frozen-lockfile
# Copy the rest of the application code
COPY . .
# Build the client for production
RUN pnpm --filter ./client build
# Make port 5000 available (server)
# Make port 3000 available (client)
EXPOSE 5000 3000
# Define the command to run the app using the start script from package.json
# CMD [ "pnpm", "start" ]
ENV NODE_ENV=production
# Start both server and client in production mode
CMD ["sh", "-c", "pnpm --filter ./server start & pnpm --filter ./client start"]