-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Dockerfile to multi-stage build
Signed-off-by: Knut Ahlers <[email protected]>
- Loading branch information
Showing
1 changed file
with
15 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
FROM golang:alpine | ||
|
||
LABEL maintainer "Knut Ahlers <[email protected]>" | ||
FROM golang:alpine as builder | ||
|
||
ADD . /go/src/github.com/Luzifer/ots | ||
WORKDIR /go/src/github.com/Luzifer/ots | ||
|
||
RUN set -ex \ | ||
&& apk add --update git ca-certificates \ | ||
&& go install -ldflags "-X main.version=$(git describe --tags || git rev-parse --short HEAD || echo dev)" \ | ||
&& apk del --purge git | ||
&& apk add --update git \ | ||
&& go install -ldflags "-X main.version=$(git describe --tags || git rev-parse --short HEAD || echo dev)" | ||
|
||
FROM alpine:latest | ||
|
||
LABEL maintainer "Knut Ahlers <[email protected]>" | ||
|
||
RUN set -ex \ | ||
&& apk --no-cache add ca-certificates | ||
|
||
COPY --from=builder /go/bin/ots /usr/local/bin/ots | ||
|
||
EXPOSE 3000 | ||
|
||
ENTRYPOINT ["/go/bin/ots"] | ||
ENTRYPOINT ["/usr/local/bin/ots"] | ||
CMD ["--"] | ||
|
||
# vim: set ft=Dockerfile: |