Skip to content

Commit 436e0af

Browse files
committed
Perform a multi-stage build
[refs #922d4d13e11d]
1 parent 571786d commit 436e0af

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
FROM golang:1.9.2-alpine
1+
FROM golang:1.9.2-alpine as builder
22

33
WORKDIR /go/src/app
44

55
COPY hello-world.go .
66

77
RUN go build hello-world.go
88

9-
CMD ./hello-world
9+
FROM alpine:3.6
10+
11+
COPY --from=builder /go/src/app/hello-world /
12+
13+
CMD /hello-world

developing/hello-world-compiled/docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ version: '3.3'
22

33
services:
44
app:
5-
image: hello-world:golang
5+
image: jfahrer/hello-world:golang
66
build:
77
context: .
88
volumes:
99
- .:/go/src/app
10-
command: sh -c "go build hello-world.go && ./hello-world"

0 commit comments

Comments
 (0)