Skip to content

Docs #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
markfaine opened this issue Jan 1, 2025 · 3 comments
Open

Docs #2

markfaine opened this issue Jan 1, 2025 · 3 comments

Comments

@markfaine
Copy link

Any docs you can point me to? This looks perfect for my use case but I need to confirm it can do everything I need. For example, how does it deal with build args (some of which need to be env as well) and build secrets?

Thanks for the hard work on what looks to be a very cool project.

@gkpln3
Copy link
Owner

gkpln3 commented Jan 1, 2025

Sadly no, but let me know what are the requirements and we can work it out :)
The current architecture is built to be pretty lean, the generator is only being used to create the dockerfiles, which can then be used as regular dockerfiles and you can use any docker command to use them.
As for build args, you can still use them, but part of the point of having the python code generate those dockerfiles is that you don't actually need to have build args, you can just add this logic in the Sandfile itself instead. same for env vars, you can use regular python import os; os.environ['MY_ENV_VAR'].
If you find any missing feature let me know so I could add it to the tool.

@markfaine
Copy link
Author

Sadly no, but let me know what are the requirements and we can work it out :) The current architecture is built to be pretty lean, the generator is only being used to create the dockerfiles, which can then be used as regular dockerfiles and you can use any docker command to use them. As for build args, you can still use them, but part of the point of having the python code generate those dockerfiles is that you don't actually need to have build args, you can just add this logic in the Sandfile itself instead. same for env vars, you can use regular python import os; os.environ['MY_ENV_VAR']. If you find any missing feature let me know so I could add it to the tool.

Thanks! When I get a chance I'll test it out. I'm currently looking at doing it with Jinja2 and Ansible but tbh your solution looks cleaner, the problem is that I need to build with some sensitive variables that I don't want to end up in the image so I need build secrets at a minimum.

@gkpln3
Copy link
Owner

gkpln3 commented Jan 2, 2025

To use build secrets you need to pass them to the run command as a mount, run mounts (RUN --mount=XXXXX) are supported, you use them like this:

Run("command", Mount="type=secret,id=aws")

or

Run("command", Mount=["type=secret,id=aws", "type=cache,target=/root/.npm"])

After the dockerfiles are generated, you can just pass the secrets as you usually would using the docker build command:

docker build --secret id=aws,src=$HOME/.aws/credentials .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants