-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
24 lines (17 loc) · 807 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
# Use Docker 1.7 multi-stage builds to minimize Docker image sizes
# 1) From a basic image with Glide installed: build our src files into a binary
# 2) Copy that binary to an even smaller container representing the final image
FROM billyteves/alpine-golang-glide:1.2.0
# Copy all files in this directory into the requisite path
ADD . /go/src/github.com/b3ntly/twelvefactor_databases
WORKDIR /go/src/github.com/b3ntly/twelvefactor_databases
# Use Glide to install all of our dependencies
RUN glide install
# Build are binary for linux
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
FROM alpine:latest
WORKDIR /root/
# Copy in our binary from the first stage
COPY --from=0 /go/src/github.com/b3ntly/twelvefactor_databases/main .
# Set the entry point to the binary
CMD ["./main"]