Unable to run "svg-sprite" in Dockerfile: "Permission denied"

Hi there,

I’m building an app through Docker, which at some point runs npx svg-sprite [...].
During local build, everything goes through fine. On Heroku too (which I’m leaving, trying to move to fly.io now). However, here on the runner, I get a “Permission denied” error - I’d love to say that there is more information to that, but from the log I can see, I don’t see nothing really interesting.

Literaly:

 => ERROR [app_builder 12/13] RUN mix assets.deploy                                                                                                   16.2s
(non interesting logs, things that go as they should)
#20 7.659 npm WARN exec The following package was not found and will be installed: svg-sprite
#20 15.38 npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
#20 16.04 sh: svg-sprite: Permission denied
#20 16.08 ** (exit) 127
(elixir's mix trace)

So I was wondering, is there any difference when building a Dockerfile on Fly, compared to a local machine or to Heroku’s build system ?
Feel free to ask me for any more information - I know there isn’t much, but I can’t seem to find anything relevant looking.

Thanks in advance !

On a side-note: if you’re wondering why I use a Dockerfile instead of the pre-built Phoenix configuration, it’s just that I worked like that before, and didn’t want to change, though I might consider it if I really can’t make it work.

Hey!

So there are two ways in which deploys happen on fly, one is a local where Docker runs locally, and builds on your machine, the other is where fly builds an image on a builder. My guess is that you might be running into an issue with the remote builder that’s building your image. What does your fly.toml and Dockerfile look like?

Hi, thanks for the reply :blush:

Indeed! It was on the remote builder. I tried on the local one and it did give me the same result - although docker build . still works correctly. Is there a way to find the command run ? I tried fly deploy ---verbose but it was not verbose enough to give me the command :smile:

The Dockerfile and fly.toml can be found on the project repository.

I worked around the issue by running npm install then ./node_modules/.bin/<my_command> - as it can be seen here. The workaround works fine, but I’d prefer to use npx if possible :smile:

Hmm, I used my remote builder and I noticed the same issue as well, so I don’t think it’s an issue with the builder. My guess is that npx has a permissions issue with accessing the priv folder destination. I’ve used npx for testing mostly and assume there might be some internal logic as to what it has access to hence the permissions issue, sorry this isn’t of much help!