Skip to content

Commit 57f402d

Browse files
committed
Stop cache busting admin assets on every CI build
1 parent 9591729 commit 57f402d

4 files changed

Lines changed: 10 additions & 32 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,6 @@ jobs:
123123
labels: ${{ steps.meta.outputs.labels }}
124124
cache-from: type=gha
125125
cache-to: type=gha,mode=max
126-
# Force re-download of admin UI static assets (dzarlax design system,
127-
# htmx) on every CI build so images ship with the latest main.
128-
build-args: |
129-
ASSETS_CACHEBUST=${{ github.sha }}
130126

131127
release-bridge:
132128
name: Release Bridge Binaries

.github/workflows/docker-arm64.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,3 @@ jobs:
4545
labels: ${{ steps.meta.outputs.labels }}
4646
cache-from: type=gha,scope=arm64
4747
cache-to: type=gha,mode=max,scope=arm64
48-
build-args: |
49-
ASSETS_CACHEBUST=${{ github.sha }}

Dockerfile

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,13 @@ FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS builder
22

33
ARG TARGETARCH
44

5-
# Admin UI static assets. Re-fetched on every build when ASSETS_CACHEBUST
6-
# differs (CI passes a timestamp / commit SHA). For local iteration, the
7-
# default value keeps the cached layer.
8-
#
9-
# Override for a one-off local refresh:
10-
# docker build --build-arg ASSETS_CACHEBUST=$(date +%s) .
11-
# Pin to a commit SHA rather than @main so jsdelivr's aggressive branch-tip
12-
# caching can't serve a stale bundle for hours after a DS push. Bump this
13-
# when you want the latest DS changes; confirm the hash exists at
14-
# github.com/dzarlax/design-system before committing.
5+
# Admin UI static assets. Pin to a commit SHA rather than @main so jsdelivr's
6+
# aggressive branch-tip caching can't serve a stale bundle for hours after a DS
7+
# push. Bump DS_VERSION or HTMX_VERSION when you want to refresh these assets;
8+
# confirm the DS hash exists at github.com/dzarlax/design-system before
9+
# committing.
1510
ARG DS_VERSION=f36e79e50e9341ef5780fb89ec41c1f49e447811
1611
ARG HTMX_VERSION=2.0.3
17-
ARG ASSETS_CACHEBUST=pinned
1812

1913
RUN apk add --no-cache curl
2014

@@ -25,10 +19,7 @@ RUN go mod download
2519

2620
COPY . .
2721

28-
# Overwrite the committed placeholders with real assets. The ASSETS_CACHEBUST
29-
# ARG is referenced so that changing it invalidates this layer.
30-
RUN echo "assets cachebust: ${ASSETS_CACHEBUST}" && \
31-
curl -fsSL "https://cdn.jsdelivr.net/gh/dzarlax/design-system@${DS_VERSION}/dist/dzarlax.css" \
22+
RUN curl -fsSL "https://cdn.jsdelivr.net/gh/dzarlax/design-system@${DS_VERSION}/dist/dzarlax.css" \
3223
-o internal/adminapi/static/dzarlax.css && \
3324
curl -fsSL "https://cdn.jsdelivr.net/gh/dzarlax/design-system@${DS_VERSION}/dist/dzarlax.js" \
3425
-o internal/adminapi/static/dzarlax.js && \

internal/adminapi/static/README.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,11 @@
22

33
These files are placeholders so `go build` works without Docker. The **real**
44
assets are downloaded from upstream at Docker build time — see the `curl`
5-
step in the repo-root `Dockerfile` (`ARG DS_VERSION`, `ARG HTMX_VERSION`,
6-
`ARG ASSETS_CACHEBUST`).
5+
step in the repo-root `Dockerfile` (`ARG DS_VERSION`, `ARG HTMX_VERSION`).
76

8-
To force a refresh of the design system on your next build, pass a new
9-
cache-bust value:
10-
11-
```bash
12-
docker build --build-arg ASSETS_CACHEBUST=$(date +%s) .
13-
```
14-
15-
CI passes this automatically so every built image ships with the current
16-
design system `@main`.
7+
To refresh the design system or htmx in built images, bump `DS_VERSION` or
8+
`HTMX_VERSION` in `Dockerfile`. Do not use branch names such as `@main` for
9+
production assets; CDN edge caches can serve stale branch-tip files.
1710

1811
Do **not** commit real builds of `dzarlax.css`, `dzarlax.js`, or
1912
`htmx.min.js` — they bloat diffs and go stale.

0 commit comments

Comments
 (0)