build: Update zig installation method

This simplifies the Dockerfile a little , as the zig package (0.12.0) is available on alpine 3.20
https://repology.org/project/zig/versions

parent image is also updated to current rust-toolchain

Signed-off-by: Yorgos Saslis <yorgos.work@proton.me>
This commit is contained in:
Yorgos Saslis 2024-10-29 11:33:53 +02:00 committed by cloudhead
parent 87f6956e49
commit 87cb7bf52d
No known key found for this signature in database
1 changed files with 4 additions and 10 deletions

View File

@ -1,5 +1,5 @@
# Builds release binaries for Radicle. # Builds release binaries for Radicle.
FROM rust:1.77.2-alpine3.19 as builder FROM rust:1.80-alpine3.20 as builder
LABEL maintainer="Radicle Team <team@radicle.xyz>" LABEL maintainer="Radicle Team <team@radicle.xyz>"
WORKDIR /src WORKDIR /src
COPY . . COPY . .
@ -13,7 +13,7 @@ ARG GIT_HEAD
# Copy cargo configuration we're going to use to specify compiler options. # Copy cargo configuration we're going to use to specify compiler options.
RUN mkdir -p .cargo && cp build/config.toml .cargo/config.toml RUN mkdir -p .cargo && cp build/config.toml .cargo/config.toml
# Install dependencies. # Install dependencies.
RUN apk update && apk add --no-cache git musl-dev minisign curl xz asciidoctor RUN apk update && apk add --no-cache git musl-dev xz asciidoctor zig
# Build man pages and strip metadata. Removes all comments, since they include # Build man pages and strip metadata. Removes all comments, since they include
# non-reproducible information, such as version numbers. # non-reproducible information, such as version numbers.
RUN asciidoctor --doctype manpage --backend manpage --destination-dir . *.1.adoc && \ RUN asciidoctor --doctype manpage --backend manpage --destination-dir . *.1.adoc && \
@ -29,13 +29,7 @@ RUN rustup target add \
# We use Zig as the linker to perform the compilation from a Linux host. # We use Zig as the linker to perform the compilation from a Linux host.
# Zig is not yet available on Debian, so we download the official binary. # Zig is not yet available on Debian, so we download the official binary.
# Compilation is done via `cargo-zigbuild` which is a wrapper around `zig`. # Compilation is done via `cargo-zigbuild` which is a wrapper around `zig`.
RUN curl -sSf -o zig.tar.xz https://ziglang.org/download/0.12.0/zig-linux-x86_64-0.12.0.tar.xz && \ RUN cargo install cargo-zigbuild@0.19.3
curl -sSf -o zig.tar.xz.minisig https://ziglang.org/download/0.12.0/zig-linux-x86_64-0.12.0.tar.xz.minisig && \
minisign -Vm zig.tar.xz -P RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U && \
xz -d -c zig.tar.xz | tar -x && \
mv zig-linux-x86_64-0.12.0/zig /usr/bin/zig && \
mv zig-linux-x86_64-0.12.0/lib /usr/lib/zig && \
cargo install cargo-zigbuild@0.18.3
# Parts of the macOS SDK are required to build Radicle, we make these available # Parts of the macOS SDK are required to build Radicle, we make these available
@ -56,7 +50,7 @@ RUN cargo zigbuild --locked --release \
# Now copy the files to a new image without all the intermediary artifacts to # Now copy the files to a new image without all the intermediary artifacts to
# save some space. # save some space.
FROM alpine:3.19 as packager FROM alpine:3.20 as packager
ARG RADICLE_VERSION ARG RADICLE_VERSION
ARG SOURCE_DATE_EPOCH ARG SOURCE_DATE_EPOCH