Files
hopreach/docker/gpuworker.Dockerfile
R0ckandClaude Sonnet 5 27e6c46acb Report the running build's version in meta.json and the map's attribution
New internal/buildinfo.Version, set via -ldflags at build time (the
release workflow passes the git tag that triggered the build; a local
`docker compose up --build` with no build-arg gets "dev", an
unmistakable non-release value) rather than duplicated per-binary
constants — all three binaries (hopreach, hopreach-shareapi,
hopreach-gpuworker) build against the same package so they always
agree on how to report it.

meta.json now carries this as Version; the frontend shows it next to
the existing "HopReach on GitHub" attribution link once meta.json
loads, so it's always obvious at a glance which release actually
generated what's on screen — useful on its own, and the foundation for
the analytics page's own version display.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CL1fUUB4jSa93caKF2inx9
2026-07-23 14:43:27 +01:00

37 lines
1.6 KiB
Docker

# Remote GPU worker — runs on a machine that actually has a GPU (this
# project's own dev/test box, for instance), not the VPS. Connects out to
# the VPS's broker (cmd/hopreach-shareapi's gpubroker routes) over WebSocket; see
# cmd/hopreach-gpuworker/main.go and README.md's "Remote GPU worker" section.
#
# Same glibc + CGO story as the main Dockerfile: gpucompute links against
# wgpu-native's prebuilt static libs, which target glibc, so both build and
# runtime stages have to follow suit.
FROM golang:1.23-bookworm AS build
# VERSION is passed by .github/workflows/release.yml as the git tag that
# triggered this build — see the main Dockerfile's own ARG VERSION comment.
ARG VERSION=dev
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY internal/ ./internal/
COPY cmd/hopreach-gpuworker/ ./cmd/hopreach-gpuworker/
RUN CGO_ENABLED=1 go build -ldflags "-X hopreach/internal/buildinfo.Version=${VERSION}" -o /app/hopreach-gpuworker ./cmd/hopreach-gpuworker
# --- runtime: just the worker binary, needs real GPU/Vulkan access ---
FROM debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates libvulkan1 mesa-vulkan-drivers \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /app/hopreach-gpuworker /app/hopreach-gpuworker
RUN chmod +x /app/hopreach-gpuworker && mkdir -p /data/dem-cache
ENV GPU_BROKER_WS_URL= \
GPU_WORKER_TOKEN= \
DEM_TILE_URL_BASE=https://s3.amazonaws.com/elevation-tiles-prod/terrarium \
DEM_CACHE_DIR=/data/dem-cache \
GPU_WORKER_RECONNECT_SECONDS=10
VOLUME ["/data/dem-cache"]
ENTRYPOINT ["/app/hopreach-gpuworker"]