tcardonne / docker-github-runner

Run GitHub Actions on self-hosted runner using Docker.
MIT License
297 stars 124 forks source link

Fix setup python #23

Closed coldfix closed 4 years ago

coldfix commented 4 years ago

Hi,

this patch allows building an image that supports the actions/setup-python action. Images with different base images can be built as follows:

docker build -t tcardonne/github-runner:ubuntu-20.04 --build-arg FROM=ubuntu:20.04
docker build -t tcardonne/github-runner:debian-buster --build-arg FROM=debian:buster-slim
...

It would be awesome if you could upload a version based on a supported environment (such as ubuntu:20.04)!

Fixes #22

tcardonne commented 4 years ago

Hello,

Thanks for your PR.

As I configured automated builds using Docker Hub, I can't use build arguments and I don't have much time to switch to GitHub Actions (shame!). Would you mind renaming the debian-buster/ folder to docker/ and creating a separate Dockerfile (Dockerfile.ubuntu-20-04 ?) with the ubuntu FROM ?

With this change I'll be able to create automated builds for ubuntu:20.04.

coldfix commented 4 years ago

Hi,

thanks for your reply!

As I configured automated builds using Docker Hub, I can't use build arguments and I don't have much time to switch to GitHub Actions (shame!).

Oh, I see, my experience with Docker Hub is relatively limited apart from uploading one image manually. However, from some google research it seems there is a way to override build arguments using build hooks, see Advanced options for Autobuild and Autotest. I have updated the branch to include such a hook. You would then have to add an autobuild configuration with Docker Tag set to ubuntu-20.04. The hook will look at the resulting $IMAGE_NAME, extract its tag, replace the first dash - by a colon :, and pass this as FROM argument.

Would you mind renaming the debian-buster/ folder to docker/ and creating a separate Dockerfile (Dockerfile.ubuntu-20-04 ?) with the ubuntu FROM ?

For now, we could avoid the duplicated Dockerfile code by using the hook-based method above. However, this of course only works because the two base images are similar enough; if later on adding base images with more differences that require actual customizations, this may be the most suitable option anyway. Which option do you prefer?

coldfix commented 4 years ago

Hi,

just in case this slipped under the radar, do you prefer:

Best, Thomas

tcardonne commented 4 years ago

Hello,

My apologies for the delay. I created a new release (v1.6.0) with your changes. I fixed the hook to fit the tag scheme (vX.YZ).

As stated in the release notes :

Debian Buster images are tagged with latest and vX.Y.Z and Ubuntu Focal are tagged with ubuntu-20.04 and vX.Y.Z-ubuntu-20.04.

Hope it will fix your initial issue with Python.

Thanks again for your patience and your contribution!

coldfix commented 4 years ago

Awesome, thanks!

I fixed the hook to fit the tag scheme (vX.YZ).

Oh, sorry somehow missed that.