Add support for --build-args
As this docker/docker#15182 functionality has been merged, it would be great to manage with Compose
I.e.:
Dockerfile with default variables
ARG vhost=default.com
RUN echo $vhost > ...
Overriding through docker-composer.yml
web:
build: ...
arguments:
- vhost: dev.com
Or an hierarchy of extended environments
production:
extends: web
arguments:
- vhost: my-final-domain.com
I've been wanting to make a change to the build config, something like this:
web:
build:
context: .
dockerfile: dockerfiles/path/Dockerfile
arguments:
arg1: ...
I created a proposal for this configuration change at #2163
+1 on this feature request
+1 on passing environment variables onto the build step via compose
+1
I'm stuck at Compose right now... :( Please please add this support...
I can sucessfully build with the the --build-arg because I need the HTTP_PROXY on my build servers... :(
[root@pppdc9prda2x npmo-docker-compose]# docker build --build-arg HTTP_PROXY=$HTTP_PROXY -t configure -f ./configure.Dockerfile .
Sending build context to Docker daemon 141.8 kB
Step 1 : FROM node:4-onbuild
# Executing 3 build triggers...
Step 1 : COPY package.json /usr/src/app/
---> Using cache
Step 1 : RUN npm install
---> Using cache
Step 1 : COPY . /usr/src/app
---> 52f129b79095
Removing intermediate container 00cb3b4651d4
Step 2 : CMD npm run configure
---> Running in 7d0642695c58
---> db140f15fe39
Removing intermediate container 7d0642695c58
Successfully built db140f15fe39
Build from compose
I still get a build stuck trying to connect to resources... I would propose:
build_args:
- HTTP_PROXY=$HTTP_PROXY
licenseData:
image: busybox
volumes:
- .license.json:/usr/src/app/.license.json
configure:
build: .
dockerfile: configure.Dockerfile
build_args:
- HTTP_PROXY=$HTTP_PROXY
volumes_from:
- "licenseData"
environment:
- HTTP_PROXY=$HTTP_PROXY
The build just hangs...
[root@pppdc9prda2x npmo-docker-compose]# docker-compose -f configure.yml up
Starting npmodockercompose_licenseData_1
Building configure
Step 1 : FROM node:4-onbuild
# Executing 3 build triggers...
Step 1 : COPY package.json /usr/src/app/
---> Using cache
Step 1 : RUN npm install
---> Running in ba76ce5f09f6
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No bin file found at ./bin/npme-docker-compose.js
npm info preinstall [email protected]
npm info attempt registry request try #1 at 9:59:27 PM
npm http request GET https://registry.npmjs.org/chalk
npm info attempt registry request try #1 at 9:59:27 PM
npm http request GET https://registry.npmjs.org/inquirer
npm info attempt registry request try #1 at 9:59:27 PM
npm http request GET https://registry.npmjs.org/lodash
npm info attempt registry request try #1 at 9:59:27 PM
npm http request GET https://registry.npmjs.org/mustache
npm info attempt registry request try #1 at 9:59:27 PM
npm http request GET https://registry.npmjs.org/request
npm info attempt registry request try #1 at 9:59:27 PM
npm http request GET https://registry.npmjs.org/yargs
npm info attempt registry request try #1 at 9:59:27 PM
npm http request GET https://registry.npmjs.org/standard
+1
+1
+1
+1
+1
+1 (I'm not a big fan of "--build-args" but as it's there, and have really big impact on building, and some people use docker-compose in their build pipeline...)
Please ... +1 !
+1 :)
+1
+1 !!
:+1:
+1
+1
+1