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

fix: permissions in with-docker example #63134

Merged
merged 2 commits into from
Mar 11, 2024
Merged

fix: permissions in with-docker example #63134

merged 2 commits into from
Mar 11, 2024

Conversation

Kinbaum
Copy link
Contributor

@Kinbaum Kinbaum commented Mar 11, 2024

What

This pr addresses an issue in Docker where the cache and the creation of its contents throw the following error:

[Error: EACCES: permission denied, mkdir '/app/.next/cache'] {
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/app/.next/cache'

This pr addresses an issue where the cache and the creation of its contents throw the following error:

```
[Error: EACCES: permission denied, mkdir '/app/.next/cache'] {
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/app/.next/cache'
```
@Kinbaum Kinbaum requested review from a team as code owners March 11, 2024 11:59
@Kinbaum Kinbaum requested review from ismaelrumzan and jh3y and removed request for a team March 11, 2024 11:59
@ijjk ijjk added the examples Issue/PR related to examples label Mar 11, 2024
Copy link
Member

@samcx samcx left a comment

Choose a reason for hiding this comment

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

Thank you for submitting a :pr:!

:lgtm:

@ijjk
Copy link
Member

ijjk commented Mar 11, 2024

Allow CI Workflow Run

  • approve CI run for commit: effe396

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@samcx samcx enabled auto-merge (squash) March 11, 2024 16:30
@samcx samcx merged commit 51665b3 into vercel:canary Mar 11, 2024
28 checks passed
@Kinbaum Kinbaum deleted the patch-2 branch March 11, 2024 16:50
@@ -22,6 +22,8 @@ WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

RUN mkdir -p public

Choose a reason for hiding this comment

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

dont need to pass -p (only single folder)
and also I think dont need to write this mkdir command (and RUN mkdir -p .next/cache below) because "COPY --from=builder --chown=nextjs:nodejs" automatically create the folder for you

samcx added a commit that referenced this pull request Mar 12, 2024
@Kinbaum
Copy link
Contributor Author

Kinbaum commented Mar 12, 2024

A few things on this

  • .next/cache doesn't exist in the builder phase and only shows up when the app starts.
  • Without explicitly making the directory in the Dockerfile, you get the error I've identified.
  • If you don't modify the permissions of the cache folder (changing owner/user is not enough), then you'll get the same error on the creation of .next/cache/images

If your not seeing any of these issue, then I would asked what version of next are you using, and are you statically generating any pages?

Navigating to a statically generated page throws the errors in the logs.

@dodyagung @samcx

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants