optimize docker build

This commit is contained in:
Stephan Müller 2019-04-19 23:20:09 +02:00
parent e9523f05ca
commit 4ff13d9bc2
No known key found for this signature in database
GPG Key ID: 4650F39E5B5E1894
2 changed files with 15 additions and 7 deletions

8
.dockerignore Normal file
View File

@ -0,0 +1,8 @@
.idea/
vendor/
dist/
dump/
dumpcerts.sh
acme.json
acme-backup.json
traefik-certs-dumper

View File

@ -1,21 +1,21 @@
FROM golang:1-alpine as builder
RUN apk --update upgrade \
&& apk --no-cache --no-progress add git make gcc musl-dev \
&& rm -rf /var/cache/apk/*
RUN apk --no-cache --no-progress add git make gcc musl-dev
WORKDIR /go/src/github.com/ldez/traefik-certs-dumper
COPY . .
RUN go get -u github.com/golang/dep/cmd/dep
ENV GO111MODULE on
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN make build
FROM alpine:3.9
RUN apk --update upgrade \
&& apk --no-cache --no-progress add ca-certificates git \
&& rm -rf /var/cache/apk/*
RUN apk --no-cache --no-progress add ca-certificates
COPY --from=builder /go/src/github.com/ldez/traefik-certs-dumper/traefik-certs-dumper /usr/bin/traefik-certs-dumper