diff --git a/Dockerfile b/Dockerfile index e8eca32..6a59d98 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,10 @@ RUN \ COPY package.json bun.lockb ./ 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 . . RUN bun run build @@ -32,6 +36,11 @@ RUN bun run build FROM node:20-alpine as runner 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 COPY --from=base /app/.next ./.next COPY --from=base /app/node_modules ./node_modules