Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

alexknipfer
Copy link
Contributor

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.


# 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/public ./public
COPY --from=builder /app/.next ./.next
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we give ownership to the entire /app directory?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@armand1m @yordis I'd love your opinion here!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that sounds reasonable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @leerob @armand1m looks like it was merged, but if we want to make that change then we need to change it to RUN chown -R nextjs:nodejs /app

Copy link
Contributor

@yordis yordis Mar 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leerob somehow I failed to see this notification

# Or use the numbers, I don't remember
COPY --chown=nextjs:nodejs --from=builder /app/public ./public

I think you meant to do that instead of moving the statement after the copy but it seems to be the same

@kodiakhq kodiakhq bot merged commit 69fe678 into vercel:canary Feb 25, 2021
@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants