Persist the Nuitka build cache

This commit is contained in:
2026-08-25 09:19:05 +00:00
parent 1c037aca58
commit 228f46c681
5 changed files with 19 additions and 2 deletions
+1
View File
@@ -1,4 +1,5 @@
upstream/HubBackend/.git upstream/HubBackend/.git
.build-cache
.venv* .venv*
build build
dist dist
+1
View File
@@ -1,4 +1,5 @@
.env .env
.build-cache/
config/config.json config/config.json
data/* data/*
!data/.gitignore !data/.gitignore
+2 -1
View File
@@ -1,6 +1,7 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
FROM python:3.12-trixie AS builder # Keep the compiler base stable so that runtime-only updates reuse the Nuitka layer.
FROM python:3.12-trixie@sha256:ef1735ee20f31133880795148379e68f8fe12f4b7a1872075477567f022edc1f AS builder
WORKDIR /build WORKDIR /build
+11 -1
View File
@@ -76,6 +76,16 @@ docker compose up -d
docker compose ps docker compose ps
``` ```
The backend build exports its complete BuildKit cache to
`.build-cache/backend`. This directory includes the intermediate Nuitka build
layers. Keep it to reuse the compiled result after Docker removes its internal
build cache. The directory can be large and is excluded from Git and the Docker
build context.
The Python builder image is pinned to a tested image digest. Update this digest
deliberately when the compiler environment needs an update. A runtime base
image update does not invalidate the Nuitka build layer.
By default, the API is available at `http://localhost:17777/api`. Swagger UI is By default, the API is available at `http://localhost:17777/api`. Swagger UI is
available at `http://localhost:17777/api/doc`. available at `http://localhost:17777/api/doc`.
The default bind address is suitable for a reverse proxy on the Docker host. The default bind address is suitable for a reverse proxy on the Docker host.
@@ -108,7 +118,7 @@ Update the backend source code. Then, rebuild the containers:
```bash ```bash
git -C upstream/HubBackend pull --ff-only git -C upstream/HubBackend pull --ff-only
docker compose build docker compose build backend
docker compose up -d docker compose up -d
``` ```
+4
View File
@@ -55,6 +55,10 @@ services:
backend: backend:
build: build:
context: . context: .
cache_from:
- type=local,src=.build-cache/backend
cache_to:
- type=local,dest=.build-cache/backend,mode=max
restart: unless-stopped restart: unless-stopped
environment: environment:
TRUST_HOST_PROXY: "1" TRUST_HOST_PROXY: "1"