Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Toutes les versions notables de TechIBase sont documentées ici. Le projet est e

## [Non publié]

- Les images multi-architectures sont construites sans émulation pour l'étape de construction de l'interface (npm et Vite tournent sur l'architecture native du serveur de construction) : une publication pouvait rester bloquée pendant des dizaines de minutes sous émulation QEMU (version 0.0.10).
## [0.0.13] - Mises à jour en un clic

- **Mises à jour en un clic (facultatif)** : un nouveau conteneur « updater » (image `ghcr.io/installation-04/techbase-updater`) permet de mettre à jour TechIBase depuis l'onglet Système du panneau d'administration : sauvegarde d'abord, changement de `TECHIBASE_VERSION`, téléchargement et redémarrage, vérification, **retour automatique** à l'ancienne version si la nouvelle ne démarre pas, et bouton « Revenir à vX.Y.Z ». Désactivé par défaut ; activé par `./install.sh --with-updater` ; réservé aux installations par images publiées. Il reçoit l'accès au socket Docker (équivalent à root sur le serveur) : il est isolé, protégé par un secret, n'accepte que trois actions fixes et l'administrateur doit retaper son mot de passe. Chaque demande et son résultat sont inscrits dans un journal d'audit (`audit_log`). Testé de bout en bout avec Docker réel en CI (`scripts/updater-e2e.sh`).
Expand Down
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
# The base is the official Debian-based postgres:15 image on purpose: existing
# TechIBase databases were created by it, so the same glibc collation applies
# and a data directory moves over unchanged.
FROM node:20-bookworm-slim AS web-build
# The web build only produces static files: run it on the builder's own architecture (never
# under QEMU emulation, where npm/esbuild can be very slow or hang).
FROM --platform=$BUILDPLATFORM node:20-bookworm-slim AS web-build
WORKDIR /app
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ ./
RUN npm run build

# Node itself, for the target architecture (the web build above may run on another one).
FROM node:20-bookworm-slim AS node-bin

FROM node:20-bookworm-slim AS api-deps
WORKDIR /app
COPY backend/package*.json ./
Expand All @@ -32,7 +37,7 @@ RUN apt-get update \
&& sed -i '/^[[:space:]]*gzip on;/d' /etc/nginx/nginx.conf # our conf.d file turns gzip on itself

# Node comes from the official image rather than a distribution package.
COPY --from=web-build /usr/local/bin/node /usr/local/bin/node
COPY --from=node-bin /usr/local/bin/node /usr/local/bin/node

WORKDIR /app
COPY --from=api-deps /app/node_modules ./node_modules
Expand Down
12 changes: 12 additions & 0 deletions backend/test/single-container.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,15 @@ test('backup then restore brings back the database AND the uploaded documents',
await db.drop();
}
});

test('multi-arch builds never run npm/vite under QEMU, and never copy a build-platform node into the image', () => {
const root = read('Dockerfile');
const front = read('frontend/Dockerfile');
assert.match(root, /FROM --platform=\$BUILDPLATFORM node:[^\n]* AS web-build/);
assert.match(front, /FROM --platform=\$BUILDPLATFORM node:[^\n]* AS build/);
// The web build may run on another architecture than the image, so the node binary of the
// final image must come from a stage on the TARGET platform, not from web-build.
assert.match(root, /COPY --from=node-bin \/usr\/local\/bin\/node/);
assert.doesNotMatch(root, /COPY --from=web-build \/usr\/local\/bin\/node/);
assert.match(root, /FROM node:[^\n]* AS node-bin/);
});
4 changes: 3 additions & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# TechIBase web front end: React build served by nginx, which also proxies /api to the backend.
FROM node:20-alpine AS build
# The build only produces static files: run it on the builder's own architecture (never under
# QEMU emulation, where npm/esbuild can be very slow or hang); only the nginx stage is per-platform.
FROM --platform=$BUILDPLATFORM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
Expand Down
Loading