Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize container build time #579

Merged
merged 1 commit into from
May 10, 2023
Merged

Commits on May 4, 2023

  1. Optimize container build time

    - Use cache mounts for pip and apt, heavily reducing network requests
      when cache is warm.
    - Remove git as a build-time dependency, other than switching to archive
      endpoints as was done in 39b4f08, this also requires either setting
      `KARAPACE_VERSION` as container build arg or building
      karapace/version.py independently.
    - Add hadolint pre-commit check for linting Dockerfile.
    - Move to using Python base images for builder and final stage. This
      allows omitting installation of some build tools. It also allows
      moving to a more recent Python version, no longer being bound by
      what's in distro repositories. Wheel availability of some of our
      Python dependencies prevents us from moving to 3.11 for now.
    - Change installation approach to construct a virtualenv in the builder
      step, and copying it unaltered to the final stage, with dependencies
      and Karapace itself installed in it. This allows having even fewer
      layers in the final stage, and is simpler.
    - Introduces a _much_ stricter .dockerignore, ignoring files by default
      and explicitly including what's required. This makes sure changes in
      unrelated files does not evict layer cache. For example, a few files
      that previously erroneously evicted caches, because everything was
      included:
      - .git/*
      - .mypy_cache/*
      - container/Dockerfile itself
      - __pycache__/*
      - .idea/*
    aiven-anton committed May 4, 2023
    Configuration menu
    Copy the full SHA
    39ca83a View commit details
    Browse the repository at this point in the history