Created
October 1, 2018 17:44
-
-
Save dj95/66a4066a7d207ad77f969383f60f5509 to your computer and use it in GitHub Desktop.
homekit-api dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# STEP 1 - Build the binary | |
# use the golang image as build image | |
FROM golang | |
# copy the local package files to the container's workspace. | |
ADD . /go/src/github.com/dj95/homekit-api | |
# set the working directory to build the application | |
WORKDIR /go/src/github.com/dj95/homekit-api | |
# install the go dependencies | |
RUN go get -u github.com/golang/dep/cmd/dep | |
RUN dep ensure | |
# compile the program | |
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -a -installsuffix cgo -o /go/bin/homekit-api | |
# STEP 2 - Build a minimal container | |
# start from scratch | |
FROM scratch | |
# copy the static executable | |
COPY --from=0 /go/bin/homekit-api /go/bin/homekit-api | |
# define the entrypoint | |
ENTRYPOINT ["/go/bin/homekit-api"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment