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

Permission denied when building Docker image #362

Open
martinm82 opened this issue Dec 13, 2022 · 3 comments · May be fixed by #384
Open

Permission denied when building Docker image #362

martinm82 opened this issue Dec 13, 2022 · 3 comments · May be fixed by #384
Labels
bug Something isn't working

Comments

@martinm82
Copy link
Contributor

Problem Description

What is actually happening

When running docker-compose I get an error that the build cannot access /opt/safe-settings when installing the npm packages.

I think the issue has been introduced with the recent root/user changes in the Dockerfile. In my opinion the fix is to run the build process as root and change only after the npm install command to the node user.

What is the expected behavior

Building the Docker image should be successful.

Error output, if available

npm WARN deprecated @types/pino-pretty@5.0.0: This is a stub types definition. pino-pretty provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/pino-std-serializers@4.0.0: This is a stub types definition. pino-std-serializers provides its own type definitions, so you do not need this installed.
npm WARN checkPermissions Missing write access to /opt/safe-settings
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.3.2 (node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN safe-settings@0.1.0-rc.26 No description

npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /opt/safe-settings
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/opt/safe-settings'
npm ERR!  [Error: EACCES: permission denied, access '/opt/safe-settings'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/opt/safe-settings'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2022-12-13T15_59_49_444Z-debug.log

Context

Are you using the hosted instance of probot/settings or running your own?

self-hosted

If running your own instance, are you using it with github.com or GitHub Enterprise?

GitHub.com

Version of probot/settings

latest

Version of GitHub Enterprise

@martinm82 martinm82 added the bug Something isn't working label Dec 13, 2022
@davyrod
Copy link

davyrod commented Dec 13, 2022

@martinm82 I had the same issue. I added the following at line 8, right before USER node:

RUN mkdir /opt/safe-settings && chown -R node:node /opt/safe-settings

@martinm82
Copy link
Contributor Author

@davyrod, yes indeed. That was as well one thing I did. But reading the Probot docs they actually state that one should use the node user to run the application only. It does not state you should use it for the installation process.

But changing permissions might be indeed the better approach as there might be during runtime other permission denied errors if some files are owned by root.

@martinm82
Copy link
Contributor Author

@davyrod I have applied the fix and created a pull request: #384

@decyjphr could you please take a look. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants