feat(bonsai): invalidation sélective du cache via CACHEBUST
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
FROM eclipse-temurin:25-jdk AS builder
|
FROM eclipse-temurin:25-jdk AS builder
|
||||||
RUN apt-get update && apt-get install -y git openssh-client && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y git openssh-client && rm -rf /var/lib/apt/lists/*
|
||||||
|
ARG CACHEBUST
|
||||||
RUN --mount=type=secret,id=ssh_key \
|
RUN --mount=type=secret,id=ssh_key \
|
||||||
--mount=type=cache,target=/root/.gradle \
|
--mount=type=cache,target=/root/.gradle \
|
||||||
mkdir -p /root/.ssh && \
|
mkdir -p /root/.ssh && \
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
FROM node:22-alpine AS builder
|
FROM node:22-alpine AS builder
|
||||||
RUN apk add --no-cache git openssh
|
RUN apk add --no-cache git openssh
|
||||||
|
ARG CACHEBUST
|
||||||
RUN --mount=type=secret,id=ssh_key \
|
RUN --mount=type=secret,id=ssh_key \
|
||||||
--mount=type=cache,target=/root/.npm \
|
--mount=type=cache,target=/root/.npm \
|
||||||
mkdir -p /root/.ssh && \
|
mkdir -p /root/.ssh && \
|
||||||
|
|||||||
+4
-2
@@ -34,13 +34,15 @@ docker compose up -d
|
|||||||
|
|
||||||
## Mise à jour
|
## Mise à jour
|
||||||
|
|
||||||
Pour rebuilder depuis le dernier commit de `main` :
|
Pour rebuilder depuis le dernier commit de `main` (sans tout reconstruire) :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker compose build --no-cache
|
CACHEBUST=$(date +%s) docker compose build
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`CACHEBUST` invalide uniquement l'étape clone+build. Les couches précédentes (installation des outils, image de base) restent en cache — le build reste rapide.
|
||||||
|
|
||||||
## Arrêt
|
## Arrêt
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ services:
|
|||||||
dockerfile: Dockerfile.api
|
dockerfile: Dockerfile.api
|
||||||
secrets:
|
secrets:
|
||||||
- ssh_key
|
- ssh_key
|
||||||
|
args:
|
||||||
|
CACHEBUST: ${CACHEBUST:-stable}
|
||||||
container_name: bonsai-api
|
container_name: bonsai-api
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -58,6 +60,8 @@ services:
|
|||||||
dockerfile: Dockerfile.webapp
|
dockerfile: Dockerfile.webapp
|
||||||
secrets:
|
secrets:
|
||||||
- ssh_key
|
- ssh_key
|
||||||
|
args:
|
||||||
|
CACHEBUST: ${CACHEBUST:-stable}
|
||||||
container_name: bonsai-webapp
|
container_name: bonsai-webapp
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
Reference in New Issue
Block a user