Image and build together#2458
Conversation
a3dade3 to
8ccc54f
Compare
|
Rebased, now only applies to V2 config. |
8ccc54f to
ce352ce
Compare
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
ce352ce to
e98ab0e
Compare
|
LGTM |
|
@dnephin does this allow something like: # docker-compose.yml
production:
- image: ham/spam
- build: ./spam
development:
- image: ham/spam-dev
- build: ./spam
- dockerfile: Dockerfile-dev |
|
@graingert Yes, but you have to use the v2 file format to use version: 2
services:
production:
image: ham/spam
build: ./spam
development:
image: ham/spam-dev
build:
context: ./spam
dockerfile: Dockerfile-devYou probably wouldn't actually define development and production as separate services in the same file, though. More likely you'd put the core config in # docker-compose.yml
version: 2
services:
spam:
image: ham/spam
build: ./spam
# docker-compose.override.yml
version: 2
services:
spam:
image: ham/spam-dev
build:
context: ./spam
dockerfile: Dockerfile-dev |
|
@aanand How does docker-compose know it needs to build "ham/spam" for |
|
I see what you were getting at now. Compose doesn't support dependent builds - you should use a tool like Shipwright for that. |
|
@aanand ah nice, thanks |
|
I've been prototyping a tool in https://github.com/dnephin/dobi that would support building chains of images (as well as a bunch of other things). There are a few docs and examples, but it could definitely use more, I need one for the ordered build use case. |
Fixes #2092
Allow both
imageandbuildin a service config, and useimageas the image name when building, if it exists.