Skip to content

Commit

Permalink
⚙️ chore: docker 멀티 스테이지 사용
Browse files Browse the repository at this point in the history
  • Loading branch information
jinddings committed Nov 12, 2024
1 parent 5d82ee6 commit 0f266d0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
19 changes: 14 additions & 5 deletions BE/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
FROM node:20
RUN mkdir -p /var/app
WORKDIR /var/app
COPY . .
# 빌드 스테이지
FROM node:20-slim as builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build

# 실행 스테이지
FROM node:20-slim
WORKDIR /var/app
COPY package*.json ./
RUN npm install --only=production
COPY --from=builder /app/dist ./dist

EXPOSE 3000
CMD [ "node", "dist/main.js" ]
CMD ["node", "dist/main.js"]
15 changes: 7 additions & 8 deletions FE/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
FROM node:20

RUN mkdir -p /var/app
WORKDIR /var/app

# 빌드 스테이지
FROM node:20-slim as builder
WORKDIR /app
COPY package*.json ./
RUN npm install

COPY . .

RUN npm run build

# 실행 스테이지
FROM node:20-slim
WORKDIR /app
RUN npm install -g serve
COPY --from=builder /app/dist ./dist

EXPOSE 5173

CMD ["serve", "-s", "dist", "-l", "5173"]

0 comments on commit 0f266d0

Please sign in to comment.