Added arch types to Docker and binary releases (#2220)
* Added several arm builds to dist.sh * Added platforms to Dockerfile and updated docs * Reverted changes made for testing * Fix docker platform images * Fix docker platform images * Update Makefile Co-authored-by: Jan Larwig <jan@larwig.com> * Update Makefile Co-authored-by: Jan Larwig <jan@larwig.com> * Update Makefile Co-authored-by: Jan Larwig <jan@larwig.com> * Formatting improvements --------- Co-authored-by: Jan Larwig <jan@larwig.com>
This commit is contained in:
		
							parent
							
								
									f3269b3f26
								
							
						
					
					
						commit
						982ae7e9d2
					
				|  | @ -7,7 +7,7 @@ | |||
| ## Breaking Changes | ||||
| 
 | ||||
| ## Changes since v7.5.0 | ||||
| 
 | ||||
| - [#2220](https://github.com/oauth2-proxy/oauth2-proxy/pull/2220) Added binary and docker release platforms (@kvanzuijlen) | ||||
| - [#2221](https://github.com/oauth2-proxy/oauth2-proxy/pull/2221) Backwards compatible fix for wrong environment variable name (OAUTH2_PROXY_GOOGLE_GROUPS) (@kvanzuijlen) | ||||
| - [#1989](https://github.com/oauth2-proxy/oauth2-proxy/pull/1989) Fix default scope for keycloak-oidc provider | ||||
| 
 | ||||
|  |  | |||
|  | @ -38,6 +38,7 @@ RUN case ${TARGETPLATFORM} in \ | |||
|          "linux/arm64" | "linux/arm/v8")  GOARCH=arm64  ;; \ | ||||
|          "linux/ppc64le")  GOARCH=ppc64le  ;; \ | ||||
|          "linux/arm/v6") GOARCH=arm GOARM=6  ;; \ | ||||
|          "linux/arm/v7") GOARCH=arm GOARM=7 ;; \ | ||||
|     esac && \ | ||||
|     printf "Building OAuth2 Proxy for arch ${GOARCH}\n" && \ | ||||
|     GOARCH=${GOARCH} VERSION=${VERSION} make build && touch jwt_signing_key.pem | ||||
|  |  | |||
							
								
								
									
										36
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										36
									
								
								Makefile
								
								
								
								
							|  | @ -39,45 +39,37 @@ build: validate-go-version clean $(BINARY) | |||
| $(BINARY): | ||||
| 	CGO_ENABLED=0 $(GO) build -a -installsuffix cgo -ldflags="-X main.VERSION=${VERSION}" -o $@ github.com/oauth2-proxy/oauth2-proxy/v7 | ||||
| 
 | ||||
| DOCKER_BUILD_PLATFORM ?= linux/amd64,linux/ppc64le,linux/arm/v6,linux/arm/v8 | ||||
| DOCKER_BUILD_PLATFORM         ?= linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v6,linux/arm/v7 | ||||
| DOCKER_BUILD_RUNTIME_IMAGE    ?= alpine:3.17.2 | ||||
| DOCKER_BUILDX_ARGS            ?= --build-arg RUNTIME_IMAGE=${DOCKER_BUILD_RUNTIME_IMAGE} | ||||
| DOCKER_BUILDX                 := docker buildx build ${DOCKER_BUILDX_ARGS} --build-arg VERSION=${VERSION} | ||||
| DOCKER_BUILDX_X_PLATFORM      := $(DOCKER_BUILDX) --platform ${DOCKER_BUILD_PLATFORM} | ||||
| DOCKER_BUILDX_PUSH := docker buildx build --push ${DOCKER_BUILDX_ARGS} --build-arg VERSION=${VERSION} | ||||
| DOCKER_BUILDX_PUSH            := $(DOCKER_BUILDX) --push | ||||
| DOCKER_BUILDX_PUSH_X_PLATFORM := $(DOCKER_BUILDX_PUSH) --platform ${DOCKER_BUILD_PLATFORM} | ||||
| 
 | ||||
| .PHONY: docker | ||||
| docker: | ||||
| 	$(DOCKER_BUILDX_X_PLATFORM) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:latest . | ||||
| 	$(DOCKER_BUILDX_X_PLATFORM) -t $(REGISTRY)/oauth2-proxy:latest -t $(REGISTRY)/oauth2-proxy:${VERSION} . | ||||
| 
 | ||||
| .PHONY: docker-all | ||||
| docker-all: docker | ||||
| 	$(DOCKER_BUILDX) --platform linux/amd64 -t $(REGISTRY)/oauth2-proxy:latest-amd64 . | ||||
| 	$(DOCKER_BUILDX_X_PLATFORM) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:${VERSION} . | ||||
| 	$(DOCKER_BUILDX) --platform linux/amd64 -t $(REGISTRY)/oauth2-proxy:${VERSION}-amd64 . | ||||
| 	$(DOCKER_BUILDX) --platform linux/arm64 -t $(REGISTRY)/oauth2-proxy:latest-arm64 . | ||||
| 	$(DOCKER_BUILDX) --platform linux/arm64 -t $(REGISTRY)/oauth2-proxy:${VERSION}-arm64 . | ||||
| 	$(DOCKER_BUILDX) --platform linux/ppc64le -t $(REGISTRY)/oauth2-proxy:latest-ppc64le . | ||||
| 	$(DOCKER_BUILDX) --platform linux/ppc64le -t $(REGISTRY)/oauth2-proxy:${VERSION}-ppc64le . | ||||
| 	$(DOCKER_BUILDX) --platform linux/arm/v6 -t $(REGISTRY)/oauth2-proxy:latest-armv6 . | ||||
| 	$(DOCKER_BUILDX) --platform linux/arm/v6 -t $(REGISTRY)/oauth2-proxy:${VERSION}-armv6 . | ||||
| 	$(DOCKER_BUILDX) --platform linux/amd64   -t $(REGISTRY)/oauth2-proxy:latest-amd64   -t $(REGISTRY)/oauth2-proxy:${VERSION}-amd64 . | ||||
| 	$(DOCKER_BUILDX) --platform linux/arm64   -t $(REGISTRY)/oauth2-proxy:latest-arm64   -t $(REGISTRY)/oauth2-proxy:${VERSION}-arm64 . | ||||
| 	$(DOCKER_BUILDX) --platform linux/ppc64le -t $(REGISTRY)/oauth2-proxy:latest-ppc64le -t $(REGISTRY)/oauth2-proxy:${VERSION}-ppc64le . | ||||
| 	$(DOCKER_BUILDX) --platform linux/arm/v6  -t $(REGISTRY)/oauth2-proxy:latest-armv6   -t $(REGISTRY)/oauth2-proxy:${VERSION}-armv6 . | ||||
| 	$(DOCKER_BUILDX) --platform linux/arm/v7  -t $(REGISTRY)/oauth2-proxy:latest-armv7   -t $(REGISTRY)/oauth2-proxy:${VERSION}-armv7 . | ||||
| 
 | ||||
| .PHONY: docker-push | ||||
| docker-push: | ||||
| 	$(DOCKER_BUILDX_PUSH_X_PLATFORM) -t $(REGISTRY)/oauth2-proxy:latest . | ||||
| 	$(DOCKER_BUILDX_PUSH_X_PLATFORM) -t $(REGISTRY)/oauth2-proxy:latest -t $(REGISTRY)/oauth2-proxy:${VERSION} . | ||||
| 
 | ||||
| .PHONY: docker-push-all | ||||
| docker-push-all: docker-push | ||||
| 	$(DOCKER_BUILDX_PUSH) --platform linux/amd64 -t $(REGISTRY)/oauth2-proxy:latest-amd64 . | ||||
| 	$(DOCKER_BUILDX_PUSH_X_PLATFORM) -t $(REGISTRY)/oauth2-proxy:${VERSION} . | ||||
| 	$(DOCKER_BUILDX_PUSH) --platform linux/amd64 -t $(REGISTRY)/oauth2-proxy:${VERSION}-amd64 . | ||||
| 	$(DOCKER_BUILDX_PUSH) --platform linux/arm64 -t $(REGISTRY)/oauth2-proxy:latest-arm64 . | ||||
| 	$(DOCKER_BUILDX_PUSH) --platform linux/arm64 -t $(REGISTRY)/oauth2-proxy:${VERSION}-arm64 . | ||||
| 	$(DOCKER_BUILDX_PUSH) --platform linux/ppc64le -t $(REGISTRY)/oauth2-proxy:latest-ppc64le . | ||||
| 	$(DOCKER_BUILDX_PUSH) --platform linux/ppc64le -t $(REGISTRY)/oauth2-proxy:${VERSION}-ppc64le . | ||||
| 	$(DOCKER_BUILDX_PUSH) --platform linux/arm/v6 -t $(REGISTRY)/oauth2-proxy:latest-armv6 . | ||||
| 	$(DOCKER_BUILDX_PUSH) --platform linux/arm/v6 -t $(REGISTRY)/oauth2-proxy:${VERSION}-armv6 . | ||||
| 	$(DOCKER_BUILDX_PUSH) --platform linux/amd64   -t $(REGISTRY)/oauth2-proxy:latest-amd64   -t $(REGISTRY)/oauth2-proxy:${VERSION}-amd64 . | ||||
| 	$(DOCKER_BUILDX_PUSH) --platform linux/arm64   -t $(REGISTRY)/oauth2-proxy:latest-arm64   -t $(REGISTRY)/oauth2-proxy:${VERSION}-arm64 . | ||||
| 	$(DOCKER_BUILDX_PUSH) --platform linux/ppc64le -t $(REGISTRY)/oauth2-proxy:latest-ppc64le -t $(REGISTRY)/oauth2-proxy:${VERSION}-ppc64le . | ||||
| 	$(DOCKER_BUILDX_PUSH) --platform linux/arm/v6  -t $(REGISTRY)/oauth2-proxy:latest-armv6   -t $(REGISTRY)/oauth2-proxy:${VERSION}-armv6 . | ||||
| 	$(DOCKER_BUILDX_PUSH) --platform linux/arm/v7  -t $(REGISTRY)/oauth2-proxy:latest-armv7   -t $(REGISTRY)/oauth2-proxy:${VERSION}-armv7 . | ||||
| 
 | ||||
| .PHONY: generate | ||||
| generate: | ||||
|  |  | |||
|  | @ -27,7 +27,7 @@ Going forward, all images shall be available at `quay.io/oauth2-proxy/oauth2-pro | |||
| 
 | ||||
|     b. Build with `$ go install github.com/oauth2-proxy/oauth2-proxy/v7@latest` which will put the binary in `$GOROOT/bin` | ||||
| 
 | ||||
|     c. Using the prebuilt docker image [quay.io/oauth2-proxy/oauth2-proxy](https://quay.io/oauth2-proxy/oauth2-proxy) (AMD64, PPC64LE, ARMv6, ARMv8 and ARM64 available) | ||||
|     c. Using the prebuilt docker image [quay.io/oauth2-proxy/oauth2-proxy](https://quay.io/oauth2-proxy/oauth2-proxy) (AMD64, PPC64LE, ARMv6, ARMv7, and ARM64 available) | ||||
| 
 | ||||
|     Prebuilt binaries can be validated by extracting the file and verifying it against the `sha256sum.txt` checksum file provided for each release starting with version `v3.0.0`. | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										18
									
								
								dist.sh
								
								
								
								
							
							
						
						
									
										18
									
								
								dist.sh
								
								
								
								
							|  | @ -7,7 +7,18 @@ if [[ -z ${BINARY} ]] || [[ -z ${VERSION} ]]; then | |||
| 	exit 1 | ||||
| fi | ||||
| 
 | ||||
| ARCHS=(darwin-amd64 linux-amd64 linux-arm64 linux-ppc64le linux-armv6 freebsd-amd64 windows-amd64) | ||||
| ARCHS=( | ||||
|   darwin-amd64 | ||||
|   darwin-arm64 | ||||
|   linux-amd64 | ||||
|   linux-arm64 | ||||
|   linux-armv5 | ||||
|   linux-armv6 | ||||
|   linux-armv7 | ||||
|   linux-ppc64le | ||||
|   freebsd-amd64 | ||||
|   windows-amd64 | ||||
| ) | ||||
| 
 | ||||
| mkdir -p release | ||||
| 
 | ||||
|  | @ -19,8 +30,9 @@ for ARCH in "${ARCHS[@]}"; do | |||
| 	GO_ARCH=$(echo $ARCH | awk -F- '{print $2}') | ||||
| 
 | ||||
| 	# Create architecture specific binaries | ||||
| 	if [[ ${GO_ARCH} == "armv6" ]]; then | ||||
| 		GO111MODULE=on GOOS=${GO_OS} GOARCH=arm GOARM=6 CGO_ENABLED=0 go build -ldflags="-X main.VERSION=${VERSION}" \ | ||||
| 	if [[ ${GO_ARCH} == armv* ]]; then | ||||
| 	  GO_ARM=$(echo $GO_ARCH | awk -Fv '{print $2}') | ||||
| 		GO111MODULE=on GOOS=${GO_OS} GOARCH=arm GOARM=${GO_ARM} CGO_ENABLED=0 go build -ldflags="-X main.VERSION=${VERSION}" \ | ||||
| 			-o release/${BINARY}-${VERSION}.${ARCH}/${BINARY} . | ||||
| 	else | ||||
| 		GO111MODULE=on GOOS=${GO_OS} GOARCH=${GO_ARCH} CGO_ENABLED=0 go build -ldflags="-X main.VERSION=${VERSION}" \ | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ slug: / | |||
| 
 | ||||
|     b. Build with `$ go install github.com/oauth2-proxy/oauth2-proxy/v7@latest` which will put the binary in `$GOPATH/bin` | ||||
| 
 | ||||
|     c. Using the prebuilt docker image [quay.io/oauth2-proxy/oauth2-proxy](https://quay.io/oauth2-proxy/oauth2-proxy) (AMD64, ARMv6 and ARM64 tags available) | ||||
|     c. Using the prebuilt docker image [quay.io/oauth2-proxy/oauth2-proxy](https://quay.io/oauth2-proxy/oauth2-proxy) (AMD64, PPC64LE, ARMv6, ARMv7, and ARM64 tags available) | ||||
| 
 | ||||
|     d. Using a [Kubernetes manifest](https://github.com/oauth2-proxy/manifests) (Helm) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue