From 816c2a6da90b41945ea396bfb8b51f041840be6e Mon Sep 17 00:00:00 2001 From: Daniel Kimsey Date: Thu, 11 Jul 2019 17:18:07 -0500 Subject: [PATCH] Move docker dep commands to earlier in the build This will let Docker cache the results of the vendor dependencies. Making re-builds during testing faster. Also clean-up spurious test & rm in ./configure --- CHANGELOG.md | 1 + Dockerfile | 5 ++++- Dockerfile.arm64 | 5 ++++- Dockerfile.armv6 | 5 ++++- configure | 4 +--- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3e458d..8463401 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ ## Changes since v3.2.0 +- [#209](https://github.com/pusher/outh2_proxy/pull/209) Improve docker build caching of layers (@dekimsey) - [#186](https://github.com/pusher/oauth2_proxy/pull/186) Make config consistent (@JoelSpeed) - [#187](https://github.com/pusher/oauth2_proxy/pull/187) Move root packages to pkg folder (@JoelSpeed) - [#65](https://github.com/pusher/oauth2_proxy/pull/65) Improvements to authenticate requests with a JWT bearer token in the `Authorization` header via diff --git a/Dockerfile b/Dockerfile index 53fca88..cc4a26e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,11 +7,14 @@ RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.s # Copy sources WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy -COPY . . # Fetch dependencies +COPY Gopkg.toml Gopkg.lock ./ RUN dep ensure --vendor-only +# Now pull in our code +COPY . . + # Build binary and make sure there is at least an empty key file. # This is useful for GCP App Engine custom runtime builds, because # you cannot use multiline variables in their app.yaml, so you have to diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index 1db9050..5360abb 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -7,11 +7,14 @@ RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.s # Copy sources WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy -COPY . . # Fetch dependencies +COPY Gopkg.toml Gopkg.lock ./ RUN dep ensure --vendor-only +# Now pull in our code +COPY . . + # Build binary and make sure there is at least an empty key file. # This is useful for GCP App Engine custom runtime builds, because # you cannot use multiline variables in their app.yaml, so you have to diff --git a/Dockerfile.armv6 b/Dockerfile.armv6 index 40cc5f5..71bbe50 100644 --- a/Dockerfile.armv6 +++ b/Dockerfile.armv6 @@ -7,11 +7,14 @@ RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.s # Copy sources WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy -COPY . . # Fetch dependencies +COPY Gopkg.toml Gopkg.lock ./ RUN dep ensure --vendor-only +# Now pull in our code +COPY . . + # Build binary and make sure there is at least an empty key file. # This is useful for GCP App Engine custom runtime builds, because # you cannot use multiline variables in their app.yaml, so you have to diff --git a/configure b/configure index f1b8ae6..71b9726 100755 --- a/configure +++ b/configure @@ -116,9 +116,7 @@ check_go_env() { cd ${0%/*} -if [ ! -f .env ]; then - rm .env -fi +rm -fv .env check_for make check_for awk