Open ludovicc opened 8 years ago
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:
As an alternative, I'd like to propose to use --label
instead of --build-args
:
captain.build.date
(or something equivalent).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”
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.