-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.cross
More file actions
46 lines (37 loc) · 1.22 KB
/
Copy pathDockerfile.cross
File metadata and controls
46 lines (37 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Multi-stage Dockerfile for cross-platform builds
FROM rust:1.75 as rust-base
# Install Python and build tools
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-dev \
build-essential \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Install maturin
RUN pip3 install maturin build twine
# Install Rust targets for cross-compilation
RUN rustup target add \
x86_64-unknown-linux-gnu \
aarch64-unknown-linux-gnu \
x86_64-pc-windows-msvc \
x86_64-apple-darwin \
aarch64-apple-darwin
# Install cross-compilation tools
RUN apt-get update && apt-get install -y \
gcc-multilib \
gcc-mingw-w64 \
&& rm -rf /var/lib/apt/lists/*
# Set up cross-compilation environment
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
ENV CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER=x86_64-w64-mingw32-gcc
# Set working directory
WORKDIR /app
# Copy source code
COPY . .
# Build script
COPY scripts/build_cross_platform.py /usr/local/bin/build_cross_platform.py
RUN chmod +x /usr/local/bin/build_cross_platform.py
# Default command
CMD ["python3", "/usr/local/bin/build_cross_platform.py", "--all"]