-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (25 loc) · 865 Bytes
/
Copy pathDockerfile
File metadata and controls
36 lines (25 loc) · 865 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
# Stage 1: Build the React frontend
FROM node:26-alpine AS build
WORKDIR /app/client
# Copy client package.json and install dependencies
COPY client/package.json ./
RUN npm install
# Copy the rest of the client app
COPY client ./
# Build the React app
RUN npm run build
# Stage 2: Create the production image
FROM node:26-alpine
WORKDIR /app
ENV NODE_ENV=production
# Copy server package.json and install dependencies
COPY server/package.json server/package-lock.json ./server/
RUN cd server && npm install --production
# Copy the rest of the server app and the built client
COPY server ./server
COPY --from=build /app/client/build ./client/build
# The server will run on port 3001 internally
# The run scripts will map the host port (8501) to this
EXPOSE 3001
# Run the backend server, which will also serve the frontend
CMD ["node", "server/server.js"]