-
Notifications
You must be signed in to change notification settings - Fork 45
/
Dockerfile
33 lines (20 loc) · 786 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# This is a multi-stage Dockerfile. The first part executes a build in a Golang
# container, and the second retrieves the binary from the build container and
# inserts it into a "scratch" image.
# Part 1: Compile the binary in a containerized Golang environment
#
FROM golang:1.14 as test
COPY . /go/src/github.com/clockworksoul/smudge
WORKDIR /go/src/github.com/clockworksoul/smudge
RUN go test -v ./...
# Part 2: Compile the binary in a containerized Go environment
#
FROM golang:1.14 as build
COPY . /go/src/github.com/clockworksoul/smudge
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /smudge github.com/clockworksoul/smudge/smudge
# Part 3: Build the Smudge image proper
#
FROM scratch as image
COPY --from=build /smudge .
EXPOSE 9999
CMD ["/smudge"]