Skip to content
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

Use build args to capture build time data #26

Open
Cryptophobia opened this issue Mar 21, 2018 · 5 comments
Open

Use build args to capture build time data #26

Cryptophobia opened this issue Mar 21, 2018 · 5 comments

Comments

@Cryptophobia
Copy link
Member

From @jchauncey on November 10, 2016 17:52

Acceptance Criteria:

  • Use the --build-args flag when running docker build to pass in the following items (and more if needed)
  • BUILD_DATE
  • VERSION

You will need to do the following in the dockerfile to persist the data into the image:

ARG VERSION
ARG BUILD_DATE
ENV VERSION $VERSION
ENV BUILD_DATE $BUILD_DATE

Copied from original issue: deis/builder#450

@Cryptophobia
Copy link
Member Author

From @jayjun on February 2, 2017 10:50

#388 implies that config variables are available during Docker builds, but that's certainly untrue. However, naively passing all config variables to --build-args probably isn't wise.

Docker discourages,

using build-time variables for passing secrets like github keys, user credentials etc.

So I'm wondering how we can pass secrets to Docker builds as well. I have an actual need for this, related to integrating Google Cloud SQL.

@Cryptophobia
Copy link
Member Author

From @bacongobbler on February 2, 2017 15:22

@jayjun I think you're talking about something else different. This issue is talking about passing in build args when we build the component itself, not the app. Apps are certainly passed in envvars during the build.

@Cryptophobia
Copy link
Member Author

@Cryptophobia
Copy link
Member Author

From @jayjun on February 2, 2017 16:45

@bacongobbler Yes, config variables are mapped to the build pod's env variables.

But running docker build doesn't automatically inject the surrounding pod's env variables into the app container that it's building (unlike buildpack shell scripts).

In fact, there's no way to add build-time environment variables until ARG was introduced.

@Cryptophobia
Copy link
Member Author

From @bacongobbler on February 2, 2017 16:56

So, to clarify your request, you would like to have environment variables injected into the build environment when you are performing a git push with an app that uses a Dockerfile. Is that correct? I was unaware that we didn't already do that. That can easily be rectified. For reference we already do this for apps that rely on buildpacks.

If it is, can you open another ticket for that? That request is separate than what is requested here.

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

No branches or pull requests

1 participant