Skip to content

Commit

Permalink
Refactor Dockerfile to improve permissions and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
walnuts1018 committed Jan 19, 2024
1 parent b2c230c commit 623dfa8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ WORKDIR /app
ENV YARN_VERSION=4.0.2
RUN corepack enable && corepack prepare yarn@${YARN_VERSION}


COPY package.json yarn.lock .yarnrc.yml ./
RUN yarn install --immutable

Expand Down Expand Up @@ -37,14 +36,12 @@ ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next
RUN mkdir .next && chown nextjs:nodejs .next

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing"
Expand Down

0 comments on commit 623dfa8

Please sign in to comment.