Update Dockerfiles

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-01-24 16:17:09 +01:00
parent cbfc002c15
commit 1a91a5d34d
No known key found for this signature in database
GPG Key ID: DC2729FDD34BE99E
2 changed files with 10 additions and 5 deletions

View File

@ -1,18 +1,21 @@
FROM golang:alpine as builder
ADD . /go/src/github.com/Luzifer/ots
COPY . /go/src/github.com/Luzifer/ots
WORKDIR /go/src/github.com/Luzifer/ots
RUN set -ex \
&& apk add --update git \
&& go install -ldflags "-X main.version=$(git describe --tags || git rev-parse --short HEAD || echo dev)"
&& go install \
-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
&& apk --no-cache add \
ca-certificates
COPY --from=builder /go/bin/ots /usr/local/bin/ots

View File

@ -2,12 +2,14 @@ FROM golang:alpine as builder
ENV CGO_ENABLED=0
ADD . /go/src/github.com/Luzifer/ots
COPY . /go/src/github.com/Luzifer/ots
WORKDIR /go/src/github.com/Luzifer/ots
RUN set -ex \
&& apk add --update git \
&& go install -ldflags "-X main.version=$(git describe --tags || git rev-parse --short HEAD || echo dev)"
&& go install \
-ldflags "-X main.version=$(git describe --tags --always || echo dev)" \
-mod=readonly
FROM scratch