Skip to content

fix(web): build image with frozen bun.lock instead of npm install#412

Merged
mgoldsborough merged 1 commit into
mainfrom
fix/web-dockerfile-frozen-bun
Jun 10, 2026
Merged

fix(web): build image with frozen bun.lock instead of npm install#412
mgoldsborough merged 1 commit into
mainfrom
fix/web-dockerfile-frozen-bun

Conversation

@mgoldsborough

Copy link
Copy Markdown
Contributor

Problem

The `Build & Push Images` CI job started failing on the web image build:

```
npm error code ETARGET
npm error notarget No matching version found for @posthog/core@1.32.0
```

Nothing changed in this repo. The break was an upstream publish race at PostHog:

Time (UTC) Event
17:43:34 PostHog publishes `posthog-js@1.386.0`
~17:43:44 Our `npm install` picks `1.386.0` as newest match for `^1.363.5`; it requires `@posthog/core@1.32.0` (exact pin)
17:43:57 PostHog publishes `@posthog/core@1.32.0` — 23s too late
17:44:06 npm fails with ETARGET

`web/Dockerfile` copied `bun.lock` but installed with `npm install`, which ignores the lockfile and re-resolves to the newest in-range version on every build — continuously exposing CI to PostHog's frequent, non-atomic releases.

Fix

Build the web image with bun against the frozen lockfile, matching the platform `Dockerfile`:

  • `FROM oven/bun:1-alpine` for the build stage
  • `bun install --frozen-lockfile` (honors `bun.lock`)
  • `bun run build`

Now deterministic: resolves to the pinned `posthog-js@1.363.5` / `@posthog/core@1.24.1`, immune to registry churn.

Verification

`bun install --frozen-lockfile` validated locally against the committed `bun.lock` — resolves to `posthog-js@1.363.5` / `@posthog/core@1.24.1`, vite present, exit 0. Full native image build runs in CI.

The web image ran `npm install`, which cannot read bun.lock and so
re-resolves every dependency to the newest in-range version on each
build. That left CI exposed to upstream publish races: posthog-js pins
@posthog/core to an exact version, and PostHog publishes the two
packages seconds apart. A build landing in that window picks the new
posthog-js while its required @posthog/core isn't live yet, failing with
ETARGET.

Switch the build stage to oven/bun:1-alpine and
`bun install --frozen-lockfile`, matching the platform Dockerfile. The
build now honors bun.lock (posthog-js@1.363.5 / @posthog/core@1.24.1)
and is deterministic regardless of registry churn.
@mgoldsborough mgoldsborough added the qa-reviewed QA review completed with no critical issues label Jun 10, 2026
@mgoldsborough mgoldsborough merged commit 9495ea9 into main Jun 10, 2026
5 checks passed
@mgoldsborough mgoldsborough deleted the fix/web-dockerfile-frozen-bun branch June 10, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

qa-reviewed QA review completed with no critical issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant