Select Git revision
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Dockerfile 1.13 KiB
FROM python:3.13-slim AS base
# READ THE NOTE on caching in the README before changing this/for more info!
ARG PIP_CACHE_DIR=
ARG APT_CACHE_DIR=
RUN rm -f /etc/apt/apt.conf.d/docker-clean
RUN if ! [ -z "$APT_CACHE_DIR" ]; then echo "Dir::Cache::Archives $APT_CACHE_DIR" >> /etc/apt/apt.conf.d/ci_caching; fi
WORKDIR /code
RUN mkdir -p /code
WORKDIR /code
# Install and build requirements in different image too reduce final image size
FROM base AS builder
# Packages needed to build psycopg with pip
# READ THE NOTE on caching in the README before changing this/for more info!
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && apt-get --no-install-recommends install -y libpq-dev gcc python3-dev
COPY requirements.txt /code
RUN python -m venv --without-pip .venv/
RUN --mount=type=cache,target=/root/.cache/pip \
pip --python /code/.venv/bin/python install -r requirements.txt
FROM base AS final
# Copy venv created in builder image with the dependencies
COPY --from=builder /code/.venv /code/.venv
COPY src/videoag_common /code/src/videoag_common