Skip to content
Snippets Groups Projects
Select Git revision
  • fa50207da10f12a4657b278d6c4b1aed839c22e5
  • main default protected
  • ci_test
  • v2.0.27 protected
  • v2.0.26 protected
  • v2.0.25 protected
  • v2.0.24 protected
  • v2.0.23 protected
  • v2.0.22 protected
  • v2.0.21 protected
  • v2.0.20 protected
  • v2.0.19 protected
  • v2.0.18 protected
  • v2.0.17 protected
  • v2.0.16 protected
  • v2.0.15 protected
  • v2.0.14 protected
  • v2.0.13 protected
  • v2.0.12 protected
  • v2.0.11 protected
  • v2.0.10 protected
  • v2.0.9 protected
  • v2.0.8 protected
23 results

backend

  • Open with
  • Download source code
  • Your workspaces

      A workspace is a virtual sandbox environment for your code in GitLab.

      No agents available to create workspaces. Please consult Workspaces documentation for troubleshooting.

  • A few technical notes

    Dockerfiles

    Venv

    The base common py image uses a venv so you need to use .venv/bin/python and pip --python .venv/bin/python

    Caching

    There are two types of caching used: One for local building and one in the CI with kaniko.

    Local Building

    The PIP_CACHE_DIR and APT_CACHE_DIR variables are empty, pip and apt use their default cache location. However, the --mount=type=CACHE option before the RUN command mounts these cache locations and so the cache can be reused between different builds. Since the locations are mounted, the files put into there (during the installation command), are not put into the final image.

    Additionally, Docker provides a script for apt to automatically clean the cache (so it does not stay in the final image). However, we don't want that, and so we need to remove the /etc/apt/apt.conf.d/docker-clean file.

    CI Building

    The PIP_CACHE_DIR and APT_CACHE_DIR variables are set by the CI to a location (.cache/pip, .cache/apt) inside the project dir. The cache option of the GitLab CI means these locations are persistent between different job runs. They need to be inside the project dir since GitLab cannot cache locations outside. When kaniko now executes the Dockerfile it will provide the environment vars with the caching locations. Pip directly reads the PIP_CACHE_DIR env var (Note that the ARG command in Docker provides the build argument as an environment variable to the container). For apt we need to put the location into /etc/apt/apt.conf.d/. The --ignore-path option of kaniko ensures that the cache is not included in the final image.

    Also see https://github.com/GoogleContainerTools/kaniko/issues/969#issuecomment-2160910028.