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

Provide automatic build arguments for Microbadger #61

Open
ludovicc opened this issue Aug 30, 2016 · 2 comments
Open

Provide automatic build arguments for Microbadger #61

ludovicc opened this issue Aug 30, 2016 · 2 comments

Comments

@ludovicc
Copy link
Contributor

Microbadger uses some build-time arguments to document a Docker image.

Those are BUILD_DATE and VCS_REF. As they are defined from the environment, it's currently not possible to include them in the build args. Could those values be defined by default in captain?

See https://microbadger.com/#/labels for reference.

Thanks.

@dkapanidis
Copy link
Member

As far as I understand the build-args needs to exist inside the Dockerfile to be compiled inside the image (and then those args are going to be available inside the containers)

I haven't investigated yet, so correct me if I'm wrong:

  • If we add build-args and those do not exist inside the Dockerfile, the build will fail (which means the build-args should be opt-in, not on by default)

As an alternative, I'd like to propose to use --label instead of --build-args:

  • Labels would work for all Dockerfiles, not just the ones prepared for this feature.
  • Those labels are not going to be visible inside the Docker image (which would be a good feature to manage though)
  • image labels should probably be namespaced to avoid conflicts with other tools (so instead of build.date, it would probably need to be captain.build.date (or something equivalent).

@ludovicc
Copy link
Contributor Author

ludovicc commented Aug 30, 2016

You are right, build-args not consumed will fail the build. I have tested that with captain.

Docker build supports adding labels and that looks like a nice feature to use here.

But instead of reinventing a set of labels specific to captain, why not use those defined by http://label-schema.org/ ? It's a first start at defining a standard to tag useful information on Docker images.

I would propose a specific extension to captain.yml here:

hello-world:
  build: Dockerfile
  image: harbur/hello-world
  label_schema:
    name: “myname”
    description: “This service does awesome Things with Things”
    usage: “/usr/doc/app-usage.txt”
    url: ”http://hello.world”
    vcs-url: "https://github.com/hello/world"
    vendor: “Stark Industries”
    version: “1.2.3”
    depends-on: “tcp://mongo:8000”
    # added by default if label_schema is used:
    #   schema-version: "1.0"
    #   build-date=”2016-04-12T23:20:50.52Z”
    # added by default if git is detected and vcs-url is set:
    #   vcs-type: “git”
    #   vcs-ref: “279FA63”

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