Add CACHEBUST build arg to force Docker image rebuilds

Docker's build cache was preventing Portainer from picking up
code changes. Adding a CACHEBUST ARG before COPY invalidates
all subsequent layers when the value changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Dorian
2026-02-13 18:05:40 +00:00
parent 330345c1ac
commit bb281b488b
4 changed files with 14 additions and 0 deletions

View File

@@ -9,6 +9,9 @@ COPY package*.json ./
# Install dependencies
RUN npm ci
# Cache-bust: change CACHEBUST value in docker-compose.yml to force rebuild
ARG CACHEBUST=1
# Copy source code
COPY . .

View File

@@ -5,6 +5,9 @@ WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts
# Cache-bust: change CACHEBUST value in docker-compose.yml to force rebuild
ARG CACHEBUST=1
# Copy source and build
COPY . .
RUN npm run build

View File

@@ -5,6 +5,9 @@ WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts
# Cache-bust: change CACHEBUST value in docker-compose.yml to force rebuild
ARG CACHEBUST=1
COPY . .
RUN npm run build
RUN npm prune --production

View File

@@ -20,6 +20,7 @@ services:
context: .
dockerfile: Dockerfile
args:
CACHEBUST: "2"
VITE_USE_MOCK_DATA: "false"
VITE_CONTENT_ORIGIN: ${FRONTEND_URL}
VITE_INDEEHUB_API_URL: /api
@@ -45,6 +46,8 @@ services:
build:
context: ./backend
dockerfile: Dockerfile
args:
CACHEBUST: "2"
restart: unless-stopped
environment:
# ── Core ─────────────────────────────────────────────
@@ -175,6 +178,8 @@ services:
build:
context: ./backend
dockerfile: Dockerfile.ffmpeg
args:
CACHEBUST: "2"
restart: unless-stopped
environment:
ENVIRONMENT: production