mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 14:03:52 +00:00
62 lines
2.1 KiB
Docker
62 lines
2.1 KiB
Docker
# syntax=docker/dockerfile:1.10.0
|
|
FROM rust:1.91.0 AS base
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
RUN apt-get update && apt-get install -y \
|
|
clang \
|
|
cmake \
|
|
patch \
|
|
libxml2-dev \
|
|
wget \
|
|
xz-utils \
|
|
curl \
|
|
git && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install osxcross
|
|
RUN git config --global --add safe.directory '*' && \
|
|
git clone https://github.com/tpoechtrager/osxcross /root/osxcross && \
|
|
cd /root/osxcross && \
|
|
wget -nc https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz && \
|
|
mv MacOSX11.3.sdk.tar.xz tarballs/ && \
|
|
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh
|
|
|
|
ENV PATH="/root/osxcross/target/bin:$PATH"
|
|
|
|
ENV OSXCROSS_SDK=MacOSX11.3.sdk \
|
|
SDKROOT=/root/osxcross/target/SDK/MacOSX11.3.sdk \
|
|
BINDGEN_EXTRA_CLANG_ARGS_aarch64_apple_darwin="--sysroot=/root/osxcross/target/SDK/MacOSX11.3.sdk -isystem /root/osxcross/target/SDK/MacOSX11.3.sdk/usr/include" \
|
|
CFLAGS_aarch64_apple_darwin="-B/root/osxcross/target/bin" \
|
|
CXXFLAGS_aarch64_apple_darwin="-B/root/osxcross/target/bin" \
|
|
CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=aarch64-apple-darwin20.4-clang \
|
|
CC_aarch64_apple_darwin=aarch64-apple-darwin20.4-clang \
|
|
CXX_aarch64_apple_darwin=aarch64-apple-darwin20.4-clang++ \
|
|
AR_aarch64_apple_darwin=aarch64-apple-darwin20.4-ar \
|
|
RANLIB_aarch64_apple_darwin=aarch64-apple-darwin20.4-ranlib \
|
|
MACOSX_DEPLOYMENT_TARGET=10.14 \
|
|
CARGO_INCREMENTAL=0 \
|
|
CARGO_NET_GIT_FETCH_WITH_CLI=true
|
|
|
|
WORKDIR /build
|
|
|
|
FROM base AS aarch64-builder
|
|
|
|
RUN rustup target add aarch64-apple-darwin
|
|
|
|
RUN mkdir -p /root/.cargo && \
|
|
echo '\
|
|
[target.aarch64-apple-darwin]\n\
|
|
linker = "aarch64-apple-darwin20.4-clang"\n\
|
|
ar = "aarch64-apple-darwin20.4-ar"\n\
|
|
' > /root/.cargo/config.toml
|
|
|
|
COPY . .
|
|
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|
--mount=type=cache,target=/usr/local/cargo/git \
|
|
--mount=type=cache,target=/build/target \
|
|
cargo build -p sandbox-agent --release --target aarch64-apple-darwin && \
|
|
mkdir -p /artifacts && \
|
|
cp target/aarch64-apple-darwin/release/sandbox-agent /artifacts/sandbox-agent-aarch64-apple-darwin
|
|
|
|
CMD ["ls", "-la", "/artifacts"]
|