Skip to content

Commit

Permalink
Update Dockerfile to multi-stage build
Browse files Browse the repository at this point in the history
Signed-off-by: Knut Ahlers <[email protected]>
  • Loading branch information
Luzifer committed May 5, 2018
1 parent 2a9affe commit 017e6e4
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions Dockerfile
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:

0 comments on commit 017e6e4

Please sign in to comment.