Skip to content

Commit bd9a573

Browse files
committed
feat: 백엔드 도커파일 작성
1 parent 81e58e4 commit bd9a573

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

services/backend/Dockerfile.local

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM node:20-alpine AS builder
2+
3+
WORKDIR /
4+
5+
# 모노레포 관련 파일 복사
6+
COPY package.json yarn.lock ./
7+
COPY turbo.json ./
8+
COPY apps/backend/package.json ./apps/backend/
9+
COPY apps/frontend/package.json ./apps/frontend/
10+
11+
# 의존성 설치
12+
RUN yarn install --frozen-lockfile
13+
14+
# 소스 코드 복사
15+
COPY apps/backend/ ./apps/backend/
16+
COPY apps/frontend/ ./apps/frontend/
17+
18+
# 프론트엔드와 백엔드 모두 빌드
19+
RUN yarn build
20+
21+
FROM node:20-alpine AS runner
22+
23+
WORKDIR /app
24+
25+
# 프로덕션 의존성만 설치하기 위한 파일들 복사
26+
COPY --from=builder package.json yarn.lock ./
27+
COPY --from=builder apps/backend/package.json ./apps/backend/
28+
29+
# 프로덕션 의존성만 설치
30+
RUN yarn install --production --frozen-lockfile
31+
32+
# 빌드된 결과물 복사
33+
COPY --from=builder apps/backend/dist ./apps/backend/dist
34+
COPY --from=builder apps/frontend/dist ./public/
35+
36+
EXPOSE 3000 1234
37+
38+
CMD ["yarn", "start"]

0 commit comments

Comments
 (0)