FROM erlang:29.0-alpine ARG TARGETARCH RUN apk add --no-cache \ bash \ build-base \ ca-certificates \ curl \ git \ nodejs \ npm \ openssl-dev \ pkgconf \ tar \ xz # Install the Gleam compiler matching the architecture of this image. RUN set -eux; \ case "$TARGETARCH" in \ amd64) GLEAM_ARCH="x86_64-unknown-linux-musl" ;; \ arm64) GLEAM_ARCH="aarch64-unknown-linux-musl" ;; \ *) echo "Unsupported architecture: $TARGETARCH" >&2; exit 1 ;; \ esac; \ curl --fail --silent --show-error --location \ "https://github.com/gleam-lang/gleam/releases/download/v1.18.1/gleam-v1.18.1-${GLEAM_ARCH}.tar.gz" \ --output /tmp/gleam.tar.gz; \ tar -xzf /tmp/gleam.tar.gz -C /tmp; \ install -m 0755 /tmp/gleam /usr/local/bin/gleam; \ rm -rf /tmp/gleam /tmp/gleam.tar.gz ENV PATH="/root/.cargo/bin:/usr/local/bin:${PATH}" # Rust is used by Queso to compile its self-contained launcher. RUN curl --fail --silent --show-error https://sh.rustup.rs \ | sh -s -- -y --profile minimal \ && rustup default stable \ && rustup target add \ x86_64-unknown-linux-musl \ aarch64-unknown-linux-musl # Zig is used for the native cross-compilation and is installed for the # architecture running the builder. RUN set -eux; \ case "$TARGETARCH" in \ amd64) ZIG_ARCH="x86_64" ;; \ arm64) ZIG_ARCH="aarch64" ;; \ *) echo "Unsupported architecture: $TARGETARCH" >&2; exit 1 ;; \ esac; \ curl --fail --silent --show-error --location \ "https://ziglang.org/download/0.16.0/zig-${ZIG_ARCH}-linux-0.16.0.tar.xz" \ --output /tmp/zig.tar.xz; \ mkdir -p /opt/zig; \ tar -xJf /tmp/zig.tar.xz --strip-components=1 -C /opt/zig; \ ln -s /opt/zig/zig /usr/local/bin/zig; \ rm -f /tmp/zig.tar.xz RUN cargo install --locked queso \ && cargo install cargo-zigbuild RUN gleam --version \ && command -v escript \ && rustup --version \ && zig version \ && queso --version \ && cargo-zigbuild --version WORKDIR /build CMD ["gleam", "build"]