Github actions using custom Docker image

Viewed 449

I have a custom docker image that run certain security checks on the Github repository and posts the results to a URL for review/analysis. I can see now that Github actions support custom Docker images. My question is will the runner environment variables and the clone repo be automatically mounted into the custom container or I need to pass them individually.

Also my custom container image is around 1G in size. Downloading and running it on every build will slow down the test and build. What is the best option in this case. Is there any way I can cache the image? If not are there any other workaround?

Thanks

1 Answers

My question is will the runner environment variables and the clone repo be automatically mounted into the custom container or I need to pass them individually.

Automatically mounted no, you have to tell him it should use your custom container:

container:
  image: ghcr.io/owner/image
  # ...

Refs: github docs

Is there any way I can cache the image? If not are there any other workaround?

I think you should check around cache action. I guess you should be able to download your image and cache the path where you download it or something like that.

Related