Skip to content

Commit

Permalink
chore: 스테이지 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
seoko97 committed Nov 21, 2024
1 parent 6f1a35b commit 05db0cd
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions apps/media/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM node:18-alpine AS base

RUN apk update
FROM base AS builder

RUN apk update

RUN apk add --no-cache python3 py3-pip build-base linux-headers libgcc libstdc++

WORKDIR /app
Expand All @@ -13,32 +16,33 @@ ENV PATH="${PATH}:${PNPM_HOME}"
RUN pnpm install -g turbo@^2.2.3

COPY . .
RUN turbo prune @app/media --docker

FROM base AS builder
RUN turbo prune @app/media --docker

WORKDIR /app
FROM base AS runner

COPY --from=base /app/out/json/ .
COPY --from=base /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN apk update

RUN pnpm install --frozen-lockfile
RUN apk add --no-cache libc6-compat python3 py3-pip build-base

COPY --from=base /app/out/full/ .
WORKDIR /app

RUN pnpm build:media
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml

FROM base AS runner
RUN npm install -g pnpm

WORKDIR /app
RUN pnpm install --frozen-lockfile

COPY --from=builder /app/out/full/ .

RUN pnpm build:media

COPY --from=builder /app/apps/media/.env /app/apps/media/dist/.env
COPY --from=builder /app/apps/media/.env /app/.env

EXPOSE 3002

ENV NODE_ENV=production

CMD ["node", "/app/apps/media/dist/src/main.js"]
CMD ["node", "/app/apps/media/dist/src/main.js"]

0 comments on commit 05db0cd

Please sign in to comment.