Unverified Commit 69fe678e authored by Alex's avatar Alex Committed by GitHub

docs(deployment): Update user ownership in docker deployment docs (#22539)

After testing the new docker deployment documentation, ran into the following error when running the container if you're using `next/image`:

```
[Error: EACCES: permission denied, unlink '/app/.next/cache/images/2+fKe4RlpMaSTNc8npKwiCItZgik9aOX9qkxnVSrsUo=/1613616499089.3hEMhfux5+SolMDEVHEaVPK2O0OlcLoYNao0yKpmYeg=.webp'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'unlink',
  path: '/app/.next/cache/images/2+fKe4RlpMaSTNc8npKwiCItZgik9aOX9qkxnVSrsUo=/1613616499089.3hEMhfux5+SolMDEVHEaVPK2O0OlcLoYNao0yKpmYeg=.webp'
}
```

This change gives the user correct ownership to have the correct permissions.
parent 0088caa1
...@@ -105,10 +105,6 @@ FROM node:alpine AS runner ...@@ -105,10 +105,6 @@ FROM node:alpine AS runner
WORKDIR /app WORKDIR /app
ENV NODE_ENV production ENV NODE_ENV production
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
USER nextjs
EXPOSE 3000
# You only need to copy next.config.js if you are NOT using the default configuration # You only need to copy next.config.js if you are NOT using the default configuration
# COPY --from=builder /app/next.config.js ./ # COPY --from=builder /app/next.config.js ./
...@@ -116,6 +112,13 @@ COPY --from=builder /app/public ./public ...@@ -116,6 +112,13 @@ COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/node_modules ./node_modules
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
RUN chown -R nextjs:nodejs /app/.next
USER nextjs
EXPOSE 3000
# Next.js collects completely anonymous telemetry data about general usage. # Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry # Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry. # Uncomment the following line in case you want to disable telemetry.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment