feat(agent): docker-based cross-compile for linux binaries
This commit is contained in:
parent
7ae14f35dd
commit
2ea5dd4b54
2 changed files with 49 additions and 0 deletions
32
agent/Dockerfile.build
Normal file
32
agent/Dockerfile.build
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# 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)
|
||||
ARG ZIG_VERSION=0.13.0
|
||||
RUN curl -fsSL https://ziglang.org/download/${ZIG_VERSION}/zig-linux-$(uname -m)-${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
|
||||
RUN mix release
|
||||
|
||||
# Default: print the produced artifacts
|
||||
CMD ["sh", "-c", "ls -la burrito_out/"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue