Skip to content

Commit

Permalink
cd: 백엔드 도커 이미지 경량화 (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdyjun authored Dec 4, 2024
1 parent be681d1 commit e491539
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
FROM node:22-alpine
FROM node:22-alpine AS builder

WORKDIR /app

RUN apk add --no-cache ffmpeg

COPY package.json yarn.lock .yarnrc.yml tsconfig.json ./
COPY .yarn .yarn
COPY server/ server/
COPY server server

RUN corepack enable && \
yarn install
RUN corepack enable
RUN yarn install

WORKDIR /app/server
RUN yarn install
RUN yarn build

FROM node:22-alpine

WORKDIR /app

RUN apk add --no-cache ffmpeg
RUN corepack enable

COPY --from=builder /app/server/package.json ./package.json
COPY --from=builder /app/yarn.lock ./yarn.lock
COPY --from=builder /app/.yarnrc.yml ./.yarnrc.yml
COPY --from=builder /app/.yarn ./.yarn
COPY --from=builder /app/server/dist ./dist
COPY server/.env ./.env

RUN yarn workspaces focus --production --all

EXPOSE 3000
CMD ["yarn", "start"]
CMD ["node", "dist/main.js"]

0 comments on commit e491539

Please sign in to comment.