chore: update Dockerfile to use builder stage
This commit is contained in:
parent
e3722f495e
commit
007d5375ef
1 changed files with 9 additions and 0 deletions
|
|
@ -24,6 +24,10 @@ RUN \
|
||||||
COPY package.json bun.lockb ./
|
COPY package.json bun.lockb ./
|
||||||
RUN bun install --frozen-lockfile
|
RUN bun install --frozen-lockfile
|
||||||
|
|
||||||
|
FROM base AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
|
||||||
# Copy the rest of the app source and build it
|
# Copy the rest of the app source and build it
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN bun run build
|
RUN bun run build
|
||||||
|
|
@ -32,6 +36,11 @@ RUN bun run build
|
||||||
FROM node:20-alpine as runner
|
FROM node:20-alpine as runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV NODE_ENV production
|
||||||
|
|
||||||
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
# Only copy what's necessary for production from the builder stage
|
# Only copy what's necessary for production from the builder stage
|
||||||
COPY --from=base /app/.next ./.next
|
COPY --from=base /app/.next ./.next
|
||||||
COPY --from=base /app/node_modules ./node_modules
|
COPY --from=base /app/node_modules ./node_modules
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue