Repository navigation
fix(docker): build the image from source so a fresh clone builds - #147
Merged
Merged
Conversation
The Dockerfile copied a pre-built binary from dist/<arch>/artex into the runtime image, but dist/ is git-ignored, so a fresh `git clone` has no such file and `docker compose up -d --build` fails with "/dist/amd64/artex: not found". Build the binary from source in the image instead: a Node 22 stage runs the frontend static export, a Go 1.26 stage runs build.sh with the same flags as the release binaries job (CGO-free cross-compile, -trimpath, pinned version), and the runtime stage copies the compiled binary. No build-context binary is needed, so a clean clone builds. Drop the now-obsolete dist/ warning in install.sh.
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.
The bug
A fresh
git cloneofmaincannot build the Docker image. TheDockerfilecopies a pre-built binary with
COPY dist/${TARGETARCH}/artex /app/artex, butdist/is git-ignored, so a clean checkout has no such file anddocker compose up -d --buildfails immediately with:Commit
1ed154emade compose build locally (build:block +image: artex:local)but left the Dockerfile still expecting the prebuilt binary, so the clean-clone
build stayed broken. This blocks anyone installing from git today.
The fix
Build the binary from source inside the image, as a multi-stage build:
webstage (node:22-bookworm-slim, Node 22 matching CI/release): runsnpm ci --ignore-scripts+npm run build:staticto produce the frontendstatic export.
buildstage (golang:1.26-bookworm, matchinggo.modand the releasebinaries job): copies the source and the frontend export into
server/webui/dist, then runsbuild.shwith the same flags as the releasebinaries job (
ARTEX_SKIP_FRONTEND=1,ARTEX_COMPRESS=0,-trimpath,-ldflags "-s -w -buildid= -X main.version=..."). The image binary and thepublished release binary therefore come from one build path.
COPY --from=build /out/artex /app/artexinstead of the dist copy.The Go build is CGO-free, so the
web/buildstages are pinned to$BUILDPLATFORMand cross-compile to$TARGETARCHwithout QEMU.install.shloses its now-obsolete "no prebuilt binary under dist/" warning.
This is intentionally the smallest change that makes a clean clone build. It
does not touch
release.yml, the recon-tool downloads, Node install method, bbotor Playwright — those are out of scope here.
Verified
docker compose -f docker-compose.yml config→ exit 0, build block valid.build.shdriven with the exact build-stage env/flags skips the frontend step,parses
--target linux/amd64, and reaches the Go compile at the configuredoutput path (confirms the build-stage contract and COPY paths).
bash -noninstall.sh,update.sh,build.sh→ OK.NOT verified (environment limits, stated plainly)
docker buildwas run. The available daemon could not reach theregistry and the base images were not cached locally, so the image could not be
built end-to-end here.
go build ./.../go vet ./...could not complete offline (incomplete modulecache, no network, and a Go 1.26.7-vs-1.26.10 toolchain gate in this
environment). No Go source was changed by this PR.
npm ci/build:staticwas not run (no network).A maintainer should confirm one real
docker compose up -d --buildfrom a cleanclone before relying on this.
Why now / relationship to #127
This is urgent: a fresh clone of
maincannot build the image today, soanyone installing from git is blocked. We wrote this scoped fix in place of
waiting for the contributor's larger change in #127 (
fix/docker-local-build-v2),which is still a draft and conflicting with
main.This does not close or replace #127. #127 can be rebased on top of the new
mainand keep the parts this PR deliberately did not touch (tool checksums,GHCR publishing, sqlmap pinning), or closed by the maintainers once this lands —
your call.
Do not merge automatically; no auto-merge is enabled.