Skip to content

Commit 8476f9c

Browse files
feat: refactor Dockerfile for multi-stage build and remove obsolete Dockerfile.koyeb
1 parent 6e21111 commit 8476f9c

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

Dockerfile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
FROM node:16-alpine
1+
# Stage 1: Build the React application and backend
2+
FROM node:16-alpine AS build-stage
23

34
WORKDIR /app
4-
5+
RUN npm install -g @babel/plugin-proposal-private-property-in-object
6+
# Install Node dependencies for backend
57
COPY backend/package*.json ./backend/
68
RUN npm ci --only=production --prefix backend
79

8-
COPY backend/ ./backend
10+
# Copy backend code
11+
COPY backend ./backend
912

13+
# Install Node dependencies for frontend
1014
COPY frontend/package*.json ./frontend/
1115
RUN npm ci --only=production --prefix frontend
1216

13-
COPY frontend/ ./frontend
17+
# Copy frontend code
18+
COPY frontend ./frontend
19+
20+
# Build the React app using react-scripts
21+
RUN cd frontend && npm run build && cd ..
22+
RUN rm -rf ./frontend/node_modules
1423

1524
ARG API_BASE_URL
1625
ENV API_BASE_URL=${API_BASE_URL}
1726

18-
RUN npm run build --prefix frontend
19-
20-
RUN rm -rf ./frontend/node_modules
21-
2227
CMD ["npm", "start", "--prefix", "backend"]

Dockerfile.koyeb

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)