Skip to content

Commit

Permalink
ci: Update Dockerfile to use Ubuntu base and install necessary depend…
Browse files Browse the repository at this point in the history
…encies for Rust cross-compilation

That other library, I think it's dead, pipeline is failing and there is not much activity so it's probably a good idea to remove reliance from it. Essentially I just need to cross-compile for arm64 linux the rest would be built natively.

Signed-off-by: Eden Reich <[email protected]>
  • Loading branch information
edenreich committed Feb 13, 2025
1 parent d749cac commit 969aab0
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
ARG TARGET_ARCH=aarch64-unknown-linux-musl

FROM clux/muslrust:1.84.0-nightly AS build
FROM ubuntu:24.04 AS build

WORKDIR /app
RUN apt-get update && apt-get install -y \
curl \
build-essential \
pkg-config \
wget \
git \
musl-tools \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*

ARG TARGET_ARCH
ENV TARGET_ARCH=${TARGET_ARCH}

COPY Cargo.toml Cargo.lock ./
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

RUN cd /tmp && \
wget https://musl.cc/aarch64-linux-musl-cross.tgz && \
tar -xzf aarch64-linux-musl-cross.tgz && \
mv aarch64-linux-musl-cross /opt/ && \
rm -rf aarch64-linux-musl-cross.tgz

WORKDIR /app

ENV RUSTFLAGS="-C target-feature=+crt-static"
ENV CC_aarch64_unknown_linux_musl=/opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc
ENV CXX_aarch64_unknown_linux_musl=/opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-g++
ENV OPENSSL_STATIC=yes
ENV OPENSSL_DIR=/usr
ENV PKG_CONFIG_ALLOW_CROSS=1

RUN rustup target add ${TARGET_ARCH}

COPY Cargo.toml Cargo.lock ./
COPY . .

RUN cargo build \
Expand Down

0 comments on commit 969aab0

Please sign in to comment.