compose icon indicating copy to clipboard operation
compose copied to clipboard

Add support for --build-args

Open kismet010 opened this issue 11 years ago • 49 comments

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

kismet010 avatar Sep 30 '15 00:09 kismet010

I've been wanting to make a change to the build config, something like this:


web:
  build:
    context: .
    dockerfile: dockerfiles/path/Dockerfile
    arguments:
      arg1: ...

dnephin avatar Sep 30 '15 00:09 dnephin

I created a proposal for this configuration change at #2163

dnephin avatar Oct 09 '15 00:10 dnephin

+1 on this feature request

smboykin avatar Nov 12 '15 14:11 smboykin

+1 on passing environment variables onto the build step via compose

snelis avatar Nov 12 '15 15:11 snelis

+1

lsborg avatar Nov 12 '15 19:11 lsborg

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

marcellodesales avatar Nov 15 '15 22:11 marcellodesales

+1

trcarden avatar Nov 16 '15 16:11 trcarden

+1

mixja avatar Nov 20 '15 02:11 mixja

+1

wr0ngway avatar Nov 20 '15 15:11 wr0ngway

+1

McSlow avatar Nov 29 '15 21:11 McSlow

+1

wricardo avatar Nov 30 '15 23:11 wricardo

+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...)

munhitsu avatar Dec 10 '15 17:12 munhitsu

Please ... +1 !

TeChn4K avatar Dec 14 '15 16:12 TeChn4K

+1 :)

slashrsm avatar Dec 15 '15 10:12 slashrsm

+1

k2tzumi avatar Dec 16 '15 06:12 k2tzumi

+1 !!

JonathanRosado avatar Dec 18 '15 18:12 JonathanRosado

:+1:

funkytaco avatar Dec 19 '15 03:12 funkytaco

+1

levivm avatar Dec 24 '15 02:12 levivm

+1

Jason-Grant avatar Dec 31 '15 11:12 Jason-Grant

+1

dirkmoors avatar Jan 05 '16 10:01 dirkmoors