Reduce docker context to improve build times
This commit is contained in:
parent
a999270cf3
commit
7ffe9b7620
@ -1 +1,5 @@
|
||||
Dockerfile.dev
|
||||
docs
|
||||
vendor
|
||||
.git
|
||||
oauth2-proxy
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
## Changes since v6.0.0
|
||||
|
||||
- [#669](https://github.com/oauth2-proxy/oauth2-proxy/pull/669) Reduce docker context to improve build times (@JoelSpeed)
|
||||
- [#668](https://github.com/oauth2-proxy/oauth2-proxy/pull/668) Use req.Host in --force-https when req.URL.Host is empty (@zucaritask)
|
||||
- [#660](https://github.com/oauth2-proxy/oauth2-proxy/pull/660) Use builder pattern to simplify requests to external endpoints (@JoelSpeed)
|
||||
- [#591](https://github.com/oauth2-proxy/oauth2-proxy/pull/591) Introduce upstream package with new reverse proxy implementation (@JoelSpeed)
|
||||
|
@ -1,4 +1,5 @@
|
||||
FROM golang:1.14-buster AS builder
|
||||
ARG VERSION
|
||||
|
||||
# Download tools
|
||||
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0
|
||||
@ -19,7 +20,7 @@ COPY . .
|
||||
# build the key into the container and then tell it where it is
|
||||
# by setting OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem
|
||||
# in app.yaml instead.
|
||||
RUN make build && touch jwt_signing_key.pem
|
||||
RUN VERSION=${VERSION} make build && touch jwt_signing_key.pem
|
||||
|
||||
# Copy binary to alpine
|
||||
FROM alpine:3.11
|
||||
|
@ -1,4 +1,5 @@
|
||||
FROM golang:1.14-buster AS builder
|
||||
ARG VERSION
|
||||
|
||||
# Download tools
|
||||
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0
|
||||
@ -19,7 +20,7 @@ COPY . .
|
||||
# build the key into the container and then tell it where it is
|
||||
# by setting OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem
|
||||
# in app.yaml instead.
|
||||
RUN GOARCH=arm64 make build && touch jwt_signing_key.pem
|
||||
RUN VERSION=${VERSION} GOARCH=arm64 make build && touch jwt_signing_key.pem
|
||||
|
||||
# Copy binary to alpine
|
||||
FROM arm64v8/alpine:3.11
|
||||
|
@ -1,4 +1,5 @@
|
||||
FROM golang:1.14-buster AS builder
|
||||
ARG VERSION
|
||||
|
||||
# Download tools
|
||||
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0
|
||||
@ -19,7 +20,7 @@ COPY . .
|
||||
# build the key into the container and then tell it where it is
|
||||
# by setting OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem
|
||||
# in app.yaml instead.
|
||||
RUN GOARCH=arm GOARM=6 make build && touch jwt_signing_key.pem
|
||||
RUN VERSION=${VERSION} GOARCH=arm GOARM=6 make build && touch jwt_signing_key.pem
|
||||
|
||||
# Copy binary to alpine
|
||||
FROM arm32v6/alpine:3.11
|
||||
|
20
Makefile
20
Makefile
@ -2,7 +2,7 @@ GO ?= go
|
||||
GOLANGCILINT ?= golangci-lint
|
||||
|
||||
BINARY := oauth2-proxy
|
||||
VERSION := $(shell git describe --always --dirty --tags 2>/dev/null || echo "undefined")
|
||||
VERSION ?= $(shell git describe --always --dirty --tags 2>/dev/null || echo "undefined")
|
||||
# Allow to override image registry.
|
||||
REGISTRY ?= quay.io/oauth2-proxy
|
||||
.NOTPARALLEL:
|
||||
@ -13,6 +13,8 @@ MINIMUM_SUPPORTED_GO_MAJOR_VERSION = 1
|
||||
MINIMUM_SUPPORTED_GO_MINOR_VERSION = 14
|
||||
GO_VERSION_VALIDATION_ERR_MSG = Golang version is not supported, please update to at least $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION).$(MINIMUM_SUPPORTED_GO_MINOR_VERSION)
|
||||
|
||||
DOCKER_BUILD := docker build --build-arg VERSION=${VERSION}
|
||||
|
||||
ifeq ($(COVER),true)
|
||||
TESTCOVER ?= -coverprofile c.out
|
||||
endif
|
||||
@ -41,17 +43,17 @@ $(BINARY):
|
||||
|
||||
.PHONY: docker
|
||||
docker:
|
||||
docker build -f Dockerfile -t $(REGISTRY)/oauth2-proxy:latest .
|
||||
$(DOCKER_BUILD) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:latest .
|
||||
|
||||
.PHONY: docker-all
|
||||
docker-all: docker
|
||||
docker build -f Dockerfile -t $(REGISTRY)/oauth2-proxy:latest-amd64 .
|
||||
docker build -f Dockerfile -t $(REGISTRY)/oauth2-proxy:${VERSION} .
|
||||
docker build -f Dockerfile -t $(REGISTRY)/oauth2-proxy:${VERSION}-amd64 .
|
||||
docker build -f Dockerfile.arm64 -t $(REGISTRY)/oauth2-proxy:latest-arm64 .
|
||||
docker build -f Dockerfile.arm64 -t $(REGISTRY)/oauth2-proxy:${VERSION}-arm64 .
|
||||
docker build -f Dockerfile.armv6 -t $(REGISTRY)/oauth2-proxy:latest-armv6 .
|
||||
docker build -f Dockerfile.armv6 -t $(REGISTRY)/oauth2-proxy:${VERSION}-armv6 .
|
||||
$(DOCKER_BUILD) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:latest-amd64 .
|
||||
$(DOCKER_BUILD) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:${VERSION} .
|
||||
$(DOCKER_BUILD) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:${VERSION}-amd64 .
|
||||
$(DOCKER_BUILD) -f Dockerfile.arm64 -t $(REGISTRY)/oauth2-proxy:latest-arm64 .
|
||||
$(DOCKER_BUILD) -f Dockerfile.arm64 -t $(REGISTRY)/oauth2-proxy:${VERSION}-arm64 .
|
||||
$(DOCKER_BUILD) -f Dockerfile.armv6 -t $(REGISTRY)/oauth2-proxy:latest-armv6 .
|
||||
$(DOCKER_BUILD) -f Dockerfile.armv6 -t $(REGISTRY)/oauth2-proxy:${VERSION}-armv6 .
|
||||
|
||||
.PHONY: docker-push
|
||||
docker-push:
|
||||
|
Loading…
Reference in New Issue
Block a user