Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 15, 2017

Conversation

dnephin
Copy link
Contributor

@dnephin dnephin commented Aug 9, 2017

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.

@codecov-io
Copy link

codecov-io commented Aug 9, 2017

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

Copy link
Collaborator

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

LGTM 🐯

@sirlatrom
Copy link
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?

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
Copy link
Member

@sirlatrom docker 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:master Aug 15, 2017
@GordonTheTurtle GordonTheTurtle 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
Contributor Author

dnephin commented Aug 15, 2017

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

@sirlatrom
Copy link
Contributor

@thaJeztah docker 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
func main() {
}

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: builder
    app:
        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 free to 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