git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #1447 from oauth2-proxy/docker-fixes

Fix docker build/push issues found during last release

commit1b335a056d57596958764eea3f1296109e3cffd3 authorJoel Speed <Joel.speed@hotmail.co.uk> dateWed 24 Nov 2021, 17:31 (5 years ago) parent6e54ac2ceb015e
4 files changed+21−82
CHANGELOG.md+1 Dockerfile.arm64−32 Dockerfile.armv6−32 Makefile+20−18
CHANGELOG.md+1
@@ -8,6 +8,7 @@
88
99## Changes since v7.2.0
1010
11+- [#1447](https://github.com/oauth2-proxy/oauth2-proxy/pull/1447) Fix docker build/push issues found during last release (@JoelSpeed)
1112- [#1433](https://github.com/oauth2-proxy/oauth2-proxy/pull/1433) Let authentication fail when session validation fails (@stippi2)
1213- [#1445](https://github.com/oauth2-proxy/oauth2-proxy/pull/1445) Fix docker container multi arch build issue by passing GOARCH details to make build (@jkandasa)
1314- [#1444](https://github.com/oauth2-proxy/oauth2-proxy/pull/1444) Update LinkedIn provider validate URL (@jkandasa)
Dockerfile.arm64deleted−32
@@ -1,32 +0,0 @@
1−FROM golang:1.16-buster AS builder
2−
3−# Copy sources
4−WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy
5−
6−# Fetch dependencies
7−COPY go.mod go.sum ./
8−RUN GO111MODULE=on go mod download
9−
10−# Now pull in our code
11−COPY . .
12−
13−ARG VERSION
14−
15−# Build binary and make sure there is at least an empty key file.
16−# This is useful for GCP App Engine custom runtime builds, because
17−# you cannot use multiline variables in their app.yaml, so you have to
18−# build the key into the container and then tell it where it is
19−# by setting OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem
20−# in app.yaml instead.
21−RUN VERSION=${VERSION} GOARCH=arm64 make build && touch jwt_signing_key.pem
22−
23−# Copy binary to alpine
24−FROM arm64v8/alpine:3.14
25−COPY nsswitch.conf /etc/nsswitch.conf
26−COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
27−COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy
28−COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/jwt_signing_key.pem /etc/ssl/private/jwt_signing_key.pem
29−
30−USER 2000:2000
31−
32−ENTRYPOINT ["/bin/oauth2-proxy"]
Dockerfile.armv6deleted−32
@@ -1,32 +0,0 @@
1−FROM golang:1.16-buster AS builder
2−
3−# Copy sources
4−WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy
5−
6−# Fetch dependencies
7−COPY go.mod go.sum ./
8−RUN GO111MODULE=on go mod download
9−
10−# Now pull in our code
11−COPY . .
12−
13−ARG VERSION
14−
15−# Build binary and make sure there is at least an empty key file.
16−# This is useful for GCP App Engine custom runtime builds, because
17−# you cannot use multiline variables in their app.yaml, so you have to
18−# build the key into the container and then tell it where it is
19−# by setting OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem
20−# in app.yaml instead.
21−RUN VERSION=${VERSION} GOARCH=arm GOARM=6 make build && touch jwt_signing_key.pem
22−
23−# Copy binary to alpine
24−FROM arm32v6/alpine:3.14
25−COPY nsswitch.conf /etc/nsswitch.conf
26−COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
27−COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy
28−COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/jwt_signing_key.pem /etc/ssl/private/jwt_signing_key.pem
29−
30−USER 2000:2000
31−
32−ENTRYPOINT ["/bin/oauth2-proxy"]
Makefile+20−18
@@ -41,36 +41,38 @@ $(BINARY):
4141
4242DOCKER_BUILD_PLATFORM ?= linux/amd64,linux/arm64,linux/arm/v6
4343DOCKER_BUILDX_ARGS ?=
44−DOCKER_BUILD := docker build --build-arg VERSION=${VERSION}
45−DOCKER_BUILDX := docker buildx build ${DOCKER_BUILDX_ARGS} --platform ${DOCKER_BUILD_PLATFORM} --build-arg VERSION=${VERSION}
44+DOCKER_BUILDX := docker buildx build ${DOCKER_BUILDX_ARGS} --build-arg VERSION=${VERSION}
45+DOCKER_BUILDX_X_PLATFORM := $(DOCKER_BUILDX) --platform ${DOCKER_BUILD_PLATFORM}
46+DOCKER_BUILDX_PUSH := docker buildx build --push
47+DOCKER_BUILDX_PUSH_X_PLATFORM := $(DOCKER_BUILDX_PUSH) --platform ${DOCKER_BUILD_PLATFORM}
4648
4749.PHONY: docker
4850docker:
49− $(DOCKER_BUILDX) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:latest .
51+ $(DOCKER_BUILDX_X_PLATFORM) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:latest .
5052
5153.PHONY: docker-all
5254docker-all: docker
53− $(DOCKER_BUILD) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:latest-amd64 .
54− $(DOCKER_BUILD) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:${VERSION} .
55− $(DOCKER_BUILD) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:${VERSION}-amd64 .
56− $(DOCKER_BUILD) -f Dockerfile.arm64 -t $(REGISTRY)/oauth2-proxy:latest-arm64 .
57− $(DOCKER_BUILD) -f Dockerfile.arm64 -t $(REGISTRY)/oauth2-proxy:${VERSION}-arm64 .
58− $(DOCKER_BUILD) -f Dockerfile.armv6 -t $(REGISTRY)/oauth2-proxy:latest-armv6 .
59− $(DOCKER_BUILD) -f Dockerfile.armv6 -t $(REGISTRY)/oauth2-proxy:${VERSION}-armv6 .
55+ $(DOCKER_BUILDX) --platform linux/amd64 -t $(REGISTRY)/oauth2-proxy:latest-amd64 .
56+ $(DOCKER_BUILDX_X_PLATFORM) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:${VERSION} .
57+ $(DOCKER_BUILDX) --platform linux/amd64 -t $(REGISTRY)/oauth2-proxy:${VERSION}-amd64 .
58+ $(DOCKER_BUILDX) --platform linux/arm64 -t $(REGISTRY)/oauth2-proxy:latest-arm64 .
59+ $(DOCKER_BUILDX) --platform linux/arm64 -t $(REGISTRY)/oauth2-proxy:${VERSION}-arm64 .
60+ $(DOCKER_BUILDX) --platform linux/arm/v6 -t $(REGISTRY)/oauth2-proxy:latest-armv6 .
61+ $(DOCKER_BUILDX) --platform linux/arm/v6 -t $(REGISTRY)/oauth2-proxy:${VERSION}-armv6 .
6062
6163.PHONY: docker-push
6264docker-push:
63− docker buildx build --push --platform ${DOCKER_BUILD_PLATFORM} -t $(REGISTRY)/oauth2-proxy:latest .
65+ $(DOCKER_BUILDX_PUSH_X_PLATFORM) -t $(REGISTRY)/oauth2-proxy:latest .
6466
6567.PHONY: docker-push-all
6668docker-push-all: docker-push
67− docker push $(REGISTRY)/oauth2-proxy:latest-amd64
68− docker push $(REGISTRY)/oauth2-proxy:${VERSION}
69− docker push $(REGISTRY)/oauth2-proxy:${VERSION}-amd64
70− docker push $(REGISTRY)/oauth2-proxy:latest-arm64
71− docker push $(REGISTRY)/oauth2-proxy:${VERSION}-arm64
72− docker push $(REGISTRY)/oauth2-proxy:latest-armv6
73− docker push $(REGISTRY)/oauth2-proxy:${VERSION}-armv6
69+ $(DOCKER_BUILDX_PUSH) --platform linux/amd64 -t $(REGISTRY)/oauth2-proxy:latest-amd64 .
70+ $(DOCKER_BUILDX_PUSH_X_PLATFORM) -t $(REGISTRY)/oauth2-proxy:${VERSION} .
71+ $(DOCKER_BUILDX_PUSH) --platform linux/amd64 -t $(REGISTRY)/oauth2-proxy:${VERSION}-amd64 .
72+ $(DOCKER_BUILDX_PUSH) --platform linux/arm64 -t $(REGISTRY)/oauth2-proxy:latest-arm64 .
73+ $(DOCKER_BUILDX_PUSH) --platform linux/arm64 -t $(REGISTRY)/oauth2-proxy:${VERSION}-arm64 .
74+ $(DOCKER_BUILDX_PUSH) --platform linux/arm/v6 -t $(REGISTRY)/oauth2-proxy:latest-armv6 .
75+ $(DOCKER_BUILDX_PUSH) --platform linux/arm/v6 -t $(REGISTRY)/oauth2-proxy:${VERSION}-armv6 .
7476
7577.PHONY: generate
7678generate: