gitpod icon indicating copy to clipboard operation
gitpod copied to clipboard

Pass user/project variables to Docker build process

Open JuJup opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe

I'm using a Docker Image based on one of your Base Images. I install a few tools and stuff, but now I want to download some files and custom tools from a S3 bucket. I'd like to avoid doing this in a init script, as those files are rarely changing. So putting them into my dockerfile seems logical for me. However, for this I need to pass credentials as arguments to my docker build, which works in a workspace, but afaik not during the automatic build of the containers.

Describe the behaviour you'd like

I'd like to access my project and user specific variables during the docker build.

Describe alternatives you've considered

I know this solution for integration with doppler (https://www.gitpod.io/blog/dynamic-aws-development-environments-with-doppler-and-gitpod), which is super useful but doesn't help in my case. Maybe I missed something, so in case this already works please let me know.

JuJup avatar Aug 22 '23 07:08 JuJup

Hi @JuJup, you could build the docker image manually inside a running Gitpod workspace. Then you push the image to your dockerhub account as a private image.

Here are some docs on how to use a private image: https://www.gitpod.io/docs/configure/workspaces/workspace-image#use-a-private-docker-image

but now I want to download some files and custom tools from a S3 bucket.

You may use a script to download those files in a temporary location (e.g. /tmp dir within a running Gitpod workspace) and in your dockerfile use a COPY ... instruction.

axonasif avatar Aug 23 '23 14:08 axonasif

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 23 '24 15:05 github-actions[bot]

@axonasif, thanks for the suggestion. However, this bypasses all the logic for creating base images, that Gitpod already does for me and which works good. So creating the image by myself in a workspace can't be a solution, as it doesn't scale well and a manual action doesn't really fit in this automated workspace management. The idea is simply to pass variables to the build process.

JuJup avatar May 29 '24 21:05 JuJup

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 29 '24 15:08 github-actions[bot]