Skip to content

Commit 60ba0d6

Browse files
committed
build: refactored prod Dockerfiles to copy source code after installing packages
1 parent d152acc commit 60ba0d6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

backend/docker/prod/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ FROM node:22.17-bookworm
22

33
WORKDIR /app
44

5-
COPY ./backend .
5+
COPY ./backend/package*.json ./
6+
COPY ./backend/tsconfig.json ./
67

78
RUN npm install
9+
10+
COPY ./backend .
811
RUN npm run build
912

1013
CMD ["sh", "-c", "npm run start"]

frontend/docker/prod/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@ FROM node:22.17-bookworm-slim AS build-stage
22

33
WORKDIR /app
44

5+
COPY ./frontend/package*.json ./
6+
COPY ./frontend/public ./public
7+
COPY ./frontend/index.html ./
8+
COPY ./frontend/tsconfig* ./
9+
COPY ./frontend/vite.config.ts ./
10+
11+
RUN npm install
12+
513
COPY ./frontend/ .
614
COPY .env .
715

8-
RUN npm install
916
RUN npm run build
1017

1118
FROM nginx:1.25.3-alpine-slim AS production-stage

0 commit comments

Comments
 (0)