fix(web): build image with frozen bun.lock instead of npm install#412
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
`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`:
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.