Skip to content

Add network and target to build in v3.4 - #430

Merged
thaJeztah merged 1 commit into
docker:masterfrom
dnephin:add-build-target-to-compose
Aug 15, 2017
Merged

Add network and target to build in v3.4#430
thaJeztah merged 1 commit into
docker:masterfrom
dnephin:add-build-target-to-compose

Conversation

@dnephin

Copy link
Copy Markdown
Contributor

Fixes#305
Related docker/compose#5011

This is basically a no-op, but it's good to keep them synced, and it will work when Compose uses the v3.4 schema.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
@codecov-io

codecov-io commented Aug 9, 2017

Copy link
Copy Markdown

Codecov Report

Merging #430 into master will not change coverage.
The diff coverage is n/a.

@@ Coverage Diff @@## master #430 +/- ##
=======================================
Coverage 46.28% 46.28% =======================================
Files 194 194 Lines 16134 16134 =======================================
Hits 7467 7467 Misses 8278 8278 Partials 389 389

@vdemeestervdemeester left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐯

@sirlatrom

Copy link
Copy Markdown
Contributor

Seeing as multi-stage builds with targets were introduced as part of docker-ce stable 17.06, is there any chance this change will be part of any 17.06.x stable patch release?

@thaJeztahthaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah

Copy link
Copy Markdown
Member

@sirlatromdocker stack deploy doesn't support build, so for the docker 17.06 release there's nothing to do; an update to docker compose could support it, but that's a separate repository

@thaJeztah
thaJeztah merged commit 04659b8 into docker:masterAug 15, 2017
@GordonTheTurtleGordonTheTurtle added this to the 17.08.0 milestone Aug 15, 2017
@dnephin
dnephin deleted the add-build-target-to-compose branch August 15, 2017 17:24
@dnephin

Copy link
Copy Markdown
ContributorAuthor

cc @shin- just an FYI that we've added these to v3.4

@sirlatrom

Copy link
Copy Markdown
Contributor

@thaJeztahdocker stack deploy doesn't support the services.service.build key, but it does validate its contents, giving errors like shown below. While that is the case, the same docker-compose.yml cannot be used for both building the images and deploying the stack.

app.go:

package main
funcmain() {
}

Dockerfile:

FROM golang:1.7.3 as builder
WORKDIR /go/src/github.com/alexellis/href-counter/
RUN go get -d -v golang.org/x/net/html
COPY app.go .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /go/src/github.com/alexellis/href-counter/app .
CMD ["./app"]

docker-compose.yml:

version: '3.3'services:
builder:
build:
context: .target: builderapp:
build:
context: .

Error message:

$ docker stack deploy --compose-file docker-compose.yml mystack
services.builder.build Additional property target is not allowed
$ docker version
Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:23:31 2017
OS/Arch: linux/amd64
Server:
Version: 17.06.0-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:19:04 2017
OS/Arch: linux/amd64
Experimental: false

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@dnephin@codecov-io@sirlatrom@thaJeztah@vdemeester@GordonTheTurtle