jbangdev / jbang-action

Docker image and Github Action to run jbang scripts
https://jbang.dev
MIT License
40 stars 11 forks source link

Do NOT use USER in the Dockerfile #12

Closed gastaldi closed 4 years ago

gastaldi commented 4 years ago

From the Github Actions documentation:

Docker actions must be run by the default Docker user (root). Do not use the USER instruction in your Dockerfile, because you won't be able to access the GITHUB_WORKSPACE. For more information, see "Using environment variables" and USER reference in the Docker documentation.

maxandersen commented 4 years ago

this will make it not work in openshift or other kubernetes secured envs ;/

gastaldi commented 4 years ago

Are you running Github actions in openshift?

maxandersen commented 4 years ago

The same container was used for standalone docker, GitHub actions and in jo from Kamesh.

Guess it's not viable.

gastaldi commented 4 years ago

Yeah, better have a separate Dockerfile for anything different than a Github action :)

At least until Microsoft fixes this

gastaldi commented 4 years ago

@maxandersen another solution is to create a GithubAction.Dockerfile with the content from this PR and reference it here: https://github.com/jbangdev/jbang-action/blob/master/action.yml#L21

maxandersen commented 4 years ago

That will be much much slower for user as GitHub will end up building it very often. They don't cache these well.

I guess the alternative option is to make two docker container - make one dependent on the other.

gastaldi commented 4 years ago

Whatever makes the error goes away, feel free to close this PR if necessary :)

gastaldi commented 4 years ago

It looks like the Dockerfile is synch'ed from https://github.com/jbangdev/jbang/tree/master/src/main/scripts/container and you might have a solution already, so I'll close this PR ;)