mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-05 09:06:58 +02:00
Cleanup Docker context and decrease build time
This is based off the work found in #1307 that was never merged. It moves around the install and copy of certain conponents to take better advantage of the Docker cache ad well as drops running tests during the build of the image. The reason for dropping tests is to improve build time and as running tests within the build while they're already being run in CI seems like an unnecessary added tax. Signed-off-by: Danny Grove <danny@drgrovellc.com>
This commit is contained in:
parent
44288212d8
commit
2226e00bd6
15
.dockerignore
Normal file
15
.dockerignore
Normal file
@ -0,0 +1,15 @@
|
||||
# Git Related Items
|
||||
.git
|
||||
.github
|
||||
.gitignore
|
||||
|
||||
# CI Related Items
|
||||
.travis.yml
|
||||
cloudbuild.yaml
|
||||
.golangci.yml
|
||||
.zappr.yaml
|
||||
|
||||
# Other
|
||||
docs
|
||||
OWNERS
|
||||
vendor
|
@ -19,8 +19,12 @@ ARG ARCH
|
||||
|
||||
WORKDIR /sigs.k8s.io/external-dns
|
||||
|
||||
COPY go.mod .
|
||||
COPY go.sum .
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN make test && make build.$ARCH
|
||||
RUN make test build.$ARCH
|
||||
|
||||
# final image
|
||||
FROM $ARCH/alpine:3.12
|
||||
|
@ -16,13 +16,17 @@ FROM golang:1.15 as builder
|
||||
|
||||
WORKDIR /sigs.k8s.io/external-dns
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install \
|
||||
ca-certificates \
|
||||
&& update-ca-certificates
|
||||
|
||||
COPY go.mod .
|
||||
COPY go.sum .
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN apt-get update && \
|
||||
apt-get install ca-certificates && \
|
||||
update-ca-certificates && \
|
||||
go mod vendor && \
|
||||
make test && \
|
||||
make build
|
||||
RUN make test build
|
||||
|
||||
FROM gcr.io/distroless/static
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user