Commit 2318067d authored by Geoff Simmons's avatar Geoff Simmons

Use a multi-stage Docker build to build the Ingress container.

The build process is run entirely by Docker containers, for more
reliable reproducibility.

make targets for local builds can still be run for developement,
and the check/test targets are only used locally.
parent 71253d40
FROM centos:centos7
FROM golang:1.10.3 as builder
COPY . /go/src/code.uplex.de/uplex-varnish/k8s-ingress
ARG PACKAGES
RUN go get -d -v github.com/slimhazard/gogitversion && \
cd /go/src/github.com/slimhazard/gogitversion && \
make install && \
cd /go/src/code.uplex.de/uplex-varnish/k8s-ingress && \
go get -v $PACKAGES && \
go generate && \
go build -o k8-ingress *.go
FROM centos:centos7
COPY varnishcache_varnish60.repo /etc/yum.repos.d/
RUN yum install -y epel-release && yum update -y -q && \
yum -q makecache -y --disablerepo='*' --enablerepo='varnishcache_varnish60' && \
yum-config-manager --add-repo https://pkg.uplex.de/rpm/7/uplex-varnish/x86_64/ && \
yum install -y -q varnish-6.0.1 && \
yum install -y -q --nogpgcheck vmod-re2-1.5.1 && \
yum clean all && rm -rf /var/cache/yum
COPY k8s-ingress varnish/vcl/vcl.tmpl /
ENTRYPOINT ["/k8s-ingress"]
COPY varnish/vcl/vcl.tmpl /
COPY --from=builder /go/src/code.uplex.de/uplex-varnish/k8s-ingress .
ENTRYPOINT ["./k8s-ingress"]
......@@ -67,8 +67,9 @@ ifeq ($(MINKUBE),1)
eval $(minikube docker-env)
endif
container: check docker-minikube
docker build $(DOCKER_BUILD_OPTIONS) -t $(IMAGE) .
container: docker-minikube
docker build --build-arg PACKAGES="$(PACKAGES)" \
$(DOCKER_BUILD_OPTIONS) -t $(IMAGE) .
push: docker-minikube container
docker push $(IMAGE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment