proxMon/agent/Dockerfile.build
Carsten 64dda9cb04 fix(agent): derive @version from BUILD_ID so Burrito re-extracts per build
Burrito keys its on-host install directory on `{release}_erts-{ertsver}_{appver}`
and skips extraction when `_metadata.json` is already present for that version.
With a static `@version "0.1.0"` in mix.exs, every new build landed in the same
cached dir on the target host — silently running stale code.

Now @version resolves to `0.1.0+<BUILD_ID>` where BUILD_ID is the git short SHA
(or `dev-<timestamp>` fallback). scripts/build-linux.sh computes it on the host
and passes it through Dockerfile.build's ARG/ENV, so every commit produces a
distinct Burrito install dir and fresh extraction is guaranteed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 07:51:30 +02:00

39 lines
1.4 KiB
Text

# Reproducible Burrito build environment for the agent.
# Produces linux_amd64 + linux_arm64 binaries into /work/agent/burrito_out.
# Keep elixir/OTP in sync with what the project compiles against locally
# (see `elixir --version` — currently Elixir 1.19 on OTP 28).
FROM elixir:1.19-otp-28 AS build
ENV MIX_ENV=prod DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git ca-certificates curl xz-utils unzip 7zip \
&& rm -rf /var/lib/apt/lists/*
# Zig (Burrito needs it for cross-compile).
# Zig 0.15.x flipped the tarball naming from zig-linux-ARCH- to zig-ARCH-linux-;
# keep the URL pattern in sync if you bump the version.
ARG ZIG_VERSION=0.15.2
RUN curl -fsSL https://ziglang.org/download/${ZIG_VERSION}/zig-$(uname -m)-linux-${ZIG_VERSION}.tar.xz \
| tar -xJ -C /opt && ln -s /opt/zig-*-linux-*/zig /usr/local/bin/zig
WORKDIR /work/agent
RUN mix local.hex --force && mix local.rebar --force
# Copy sources last for layer caching
COPY mix.exs mix.lock ./
RUN mix deps.get --only prod
COPY lib lib
COPY config config
RUN mix deps.compile
# BUILD_ID is injected by scripts/build-linux.sh (typically the git short SHA).
# Declared here — not earlier — so deps.compile stays cacheable across builds.
ARG BUILD_ID=dev
ENV BUILD_ID=${BUILD_ID}
RUN mix release
# Default: print the produced artifacts
CMD ["sh", "-c", "ls -la burrito_out/"]