diff --git a/Dockerfile b/Dockerfile index 6364b91..6fc6319 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM node:18-alpine AS base FROM base AS deps # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. RUN apk add --no-cache libc6-compat -WORKDIR /app +WORKDIR /workspace # Install dependencies based on the preferred package manager COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ @@ -18,8 +18,8 @@ RUN \ # Rebuild the source code only when needed FROM base AS builder -WORKDIR /app -COPY --from=deps /app/node_modules ./node_modules +WORKDIR /workspace +COPY --from=deps /workspace/node_modules ./node_modules COPY . . # Next.js collects completely anonymous telemetry data about general usage. @@ -34,7 +34,7 @@ RUN yarn build # Production image, copy all the files and run next FROM base AS runner -WORKDIR /app +WORKDIR /workspace ENV NODE_ENV production # Uncomment the following line in case you want to disable telemetry during runtime. @@ -43,7 +43,7 @@ ENV NODE_ENV production RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs -COPY --from=builder /app/public ./public +COPY --from=builder /workspace/public ./public # Set the correct permission for prerender cache RUN mkdir .next @@ -51,8 +51,8 @@ RUN chown nextjs:nodejs .next # Automatically leverage output traces to reduce image size # https://nextjs.org/docs/advanced-features/output-file-tracing -COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ -COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static +COPY --from=builder --chown=nextjs:nodejs /workspace/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /workspace/.next/static ./.next/static USER nextjs