Files
Anthias/docker/Dockerfile.test.j2
Viktor Petersson 7fc57fecf0 fix(docker): pull the BuildKit frontend via mirror.gcr.io (#3008)
* fix(docker): pull the BuildKit frontend via mirror.gcr.io

The `# syntax=docker/dockerfile:1.4` directive made every image build
fetch the frontend from registry-1.docker.io — the last remaining
Docker Hub dependency (base images already come from mirror.gcr.io,
bun/uv from ghcr.io). Docker Hub pulls from shared GitHub runner IPs
intermittently time out, failing CI before the build even starts.

Re-point the directive at Google's pull-through cache, which serves
the same multi-arch manifest list. The version pin stays for frontend
reproducibility.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(docker): bump the BuildKit frontend pin from 1.4 to 1.24

1.4 dates to May 2022; 1.24 is the current release. Nothing in the
templates needs newer syntax (--mount=type=cache predates 1.4), so
this is purely picking up four years of frontend bugfixes. Keeps the
minor-pin convention — the tag floats only over patch releases.

Validated by building the rendered redis image against the mirrored
1.24 frontend.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(docker): use ENV key=value form flagged by 1.24 build checks

`docker build --check` with the 1.24 frontend flags the legacy
`ENV DEBIAN_FRONTEND noninteractive` form (LegacyKeyValueFormat) in
the test template — the only hit across all four templates. All
rendered Dockerfiles now lint clean against the new frontend.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 07:41:21 +02:00

75 lines
2.3 KiB
Django/Jinja

# syntax=mirror.gcr.io/docker/dockerfile:1.24
# vim: ft=dockerfile
{% include 'uv-builder.j2' %}
{% include 'Dockerfile.base.j2' %}
# @TODO: Uncomment this build stage when test_add_asset_streaming is fixed.
# FROM debian:buster as builder
# RUN apt-get update && \
# apt-get -y install --no-install-recommends \
# build-essential \
# git \
# ca-certificates && \
# apt-get clean
# RUN cd /opt && \
# git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg && \
# cd ffmpeg && \
# git checkout 2ca65fc7b74444edd51d5803a2c1e05a801a6023 && \
# ./configure --disable-x86asm && make -j$(nproc) --quiet
ENV DEBIAN_FRONTEND=noninteractive
{% if apt_dependencies %}
{% if disable_cache_mounts %}
RUN \
{% else %}
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
{% endif %}
apt-get -y install \
{% for dependency in apt_dependencies %}
{% if not loop.last %}
{{ dependency }} \
{% else %}
{{ dependency }}
{% endif %}
{% endfor %}
{% endif %}
COPY --from=ghcr.io/screenly/bun:1.3.13-slim /usr/local/bin/bun /usr/local/bin/bun
RUN ln -sf bun /usr/local/bin/bunx
# @TODO: Uncomment the lines below when test_add_asset_streaming is fixed.
# WORKDIR /opt/ffmpeg
# COPY --from=builder /opt/ffmpeg/ffserver ./
COPY --from=uv-builder /venv /venv
ENV PATH="/venv/bin:$PATH"
ENV VIRTUAL_ENV="/venv"
# Playwright bundles its own Chromium + the matching driver. Install
# under /opt/playwright so the path is deterministic and visible to
# the running pytest process via PLAYWRIGHT_BROWSERS_PATH (the default
# under HOME=/data would land in /data/.cache and be hidden behind the
# anthias-data volume mount during tests). `--with-deps` runs apt-get
# under the hood for the system libs Chromium currently needs; that's
# upstream-managed so we don't curate the package list ourselves.
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/playwright
RUN playwright install --with-deps chromium
RUN mkdir -p /usr/src/app
COPY . /usr/src/app
WORKDIR /usr/src/app
RUN mkdir -p /data/.anthias /data/anthias_assets
RUN cp ansible/roles/anthias/files/anthias.conf \
/data/.anthias
ENV GIT_HASH={{ git_hash }}
ENV GIT_SHORT_HASH={{ git_short_hash }}
ENV GIT_BRANCH={{ git_branch }}
ENV DJANGO_SETTINGS_MODULE="anthias_server.django_project.settings"
ENV PYTHONPATH="/usr/src/app/src"