Skip to content

Conversation

JoelSpeed
Copy link
Member

@JoelSpeed JoelSpeed commented Jul 7, 2020

Description

Use the .dockerignore file to exclude large directories and files from the build to reduce the build context.

Motivation and Context

I've been using WSL lately which has very poor IO at the moment. The build context we were sending to build was 220MB on my machine (about 100MB in .git, 60MB in docs/vendor, 20MB in a oauth2-proxy binary I had sitting around).

With these added ignores, I reduced the context to 14MB and it now passes the context to docker within a reasonable time frame.

To achieve this, I had to pass the version as a build arg. Which does mean that we can now override the version in the Makefile, which is not ideal but I expect no one to actually use it when publishing releases so it should be fine, right?

How Has This Been Tested?

Manually built the image, ran the image with --version to see the builder version passed through correctly

$ make docker
$ docker run --rm -it quay.io/oauth2-proxy/oauth2-proxy --version
oauth2-proxy v6.0.0-46-gd297666-dirty (built with go1.14.4)

Checklist:

  • My change requires a change to the documentation or CHANGELOG.
  • I have updated the documentation/CHANGELOG accordingly.
  • I have created a feature (non-master) branch for my PR.

@JoelSpeed JoelSpeed requested a review from a team as a code owner July 7, 2020 09:00
NickMeves
NickMeves previously approved these changes Jul 7, 2020
Copy link
Contributor

@NickMeves NickMeves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@JoelSpeed
Copy link
Member Author

@NickMeves rebased and added the changelog entry, please double check the entry and merge if you're happy

@NickMeves NickMeves merged commit e6903d8 into master Jul 7, 2020
@JoelSpeed JoelSpeed deleted the docker-ignore branch July 8, 2020 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants