1
0
Fork 0
mirror of https://github.com/Luzifer/share.git synced 2024-12-29 23:11:18 +00:00

Improve Dockerfile

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-01-27 21:13:02 +01:00
parent 4a9444e6cd
commit 0f6c1695bc
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -1,16 +1,27 @@
FROM golang:alpine FROM golang:alpine as builder
LABEL maintainer "Knut Ahlers <knut@ahlers.me>" COPY . /go/src/github.com/Luzifer/share
ADD . /go/src/github.com/Luzifer/share
WORKDIR /go/src/github.com/Luzifer/share WORKDIR /go/src/github.com/Luzifer/share
RUN set -ex \ RUN set -ex \
&& apk add --update git ca-certificates \ && apk add --update git \
&& go install -ldflags "-X main.version=$(git describe --tags || git rev-parse --short HEAD || echo dev)" \ && go install \
&& apk del --purge git -ldflags "-X main.version=$(git describe --tags --always || echo dev)" \
-mod=readonly
FROM alpine:latest
LABEL maintainer "Knut Ahlers <knut@ahlers.me>"
RUN set -ex \
&& apk --no-cache add \
ca-certificates
COPY --from=builder /go/bin/share /usr/local/bin/share
EXPOSE 3000 EXPOSE 3000
ENTRYPOINT ["/go/bin/share"] ENTRYPOINT ["/usr/local/bin/share"]
CMD ["--"] CMD ["--"]
# vim: set ft=Dockerfile: