mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-07 22:43:56 -05:00
80 lines
4.1 KiB
Docker
80 lines
4.1 KiB
Docker
FROM ubuntu:24.04 AS cross-base
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Use HTTPS for package sources
|
|
RUN apt-get update && apt-get install --assume-yes --no-install-recommends ca-certificates
|
|
RUN find /etc/apt/ -type f \( -name '*.list' -o -name '*.sources' \) -exec sed -i 's|http://|https://|g' {} +
|
|
|
|
# Configure APT retries and timeouts to handle network issues
|
|
RUN echo 'Acquire::Retries \"3\";' > /etc/apt/apt.conf.d/80-retries && \
|
|
echo 'Acquire::http::Timeout \"60\";' >> /etc/apt/apt.conf.d/80-retries && \
|
|
echo 'Acquire::ftp::Timeout \"60\";' >> /etc/apt/apt.conf.d/80-retries
|
|
|
|
# configure fallback mirrors
|
|
RUN sed -i 's|URIs: https://archive.ubuntu.com/ubuntu/|URIs: https://mirror.cov.ukservers.com/ubuntu/ https://archive.ubuntu.com/ubuntu/ https://mirror.ox.ac.uk/sites/archive.ubuntu.com/ubuntu/|g' /etc/apt/sources.list.d/ubuntu.sources
|
|
|
|
RUN apt-get update && apt-get install --assume-yes --no-install-recommends git
|
|
|
|
RUN git clone https://github.com/cross-rs/cross /cross
|
|
WORKDIR /cross/docker
|
|
RUN git checkout baf457efc2555225af47963475bd70e8d2f5993f
|
|
|
|
# xargo doesn't work with Rust 1.89 and higher: https://github.com/cross-rs/cross/issues/1701.
|
|
#
|
|
# When this PR https://github.com/cross-rs/cross/pull/1580 is merged,
|
|
# we can update the checkout above and remove this replacement.
|
|
RUN sed -i 's|sh rustup-init.sh -y --no-modify-path --profile minimal|sh rustup-init.sh -y --no-modify-path --profile minimal --default-toolchain=1.88.0|' xargo.sh
|
|
|
|
RUN cp common.sh lib.sh / && /common.sh
|
|
RUN cp cmake.sh / && /cmake.sh
|
|
RUN cp xargo.sh / && /xargo.sh
|
|
|
|
FROM cross-base AS build
|
|
|
|
RUN apt-get install --assume-yes --no-install-recommends libz-mingw-w64-dev g++-mingw-w64-x86-64 gfortran-mingw-w64-x86-64
|
|
|
|
# Install Wine using OpenSUSE repository because official one is often lagging behind
|
|
RUN dpkg --add-architecture i386 && \
|
|
apt-get install --assume-yes --no-install-recommends wget gpg && \
|
|
mkdir -pm755 /etc/apt/keyrings && curl -fsSL \
|
|
https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_24.04/Release.key \
|
|
| tee /etc/apt/keyrings/obs-winehq.key >/dev/null && \
|
|
echo "deb [arch=amd64,i386 signed-by=/etc/apt/keyrings/obs-winehq.key] \
|
|
https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_24.04/ ./" \
|
|
| tee /etc/apt/sources.list.d/obs-winehq.list && \
|
|
apt-get update && apt-get install --assume-yes --install-recommends winehq-stable
|
|
|
|
# run-detectors are responsible for calling the correct interpreter for exe
|
|
# files. For some reason it does not work inside a docker container (it works
|
|
# fine in the host). So we replace the usual paths of run-detectors to run wine
|
|
# directly. This only affects the guest, we are not messing up with the host.
|
|
#
|
|
# See /usr/share/doc/binfmt-support/detectors
|
|
RUN mkdir -p /usr/lib/binfmt-support/ && \
|
|
rm -f /usr/lib/binfmt-support/run-detectors /usr/bin/run-detectors && \
|
|
ln -s /usr/bin/wine /usr/lib/binfmt-support/run-detectors && \
|
|
ln -s /usr/bin/wine /usr/bin/run-detectors
|
|
|
|
RUN cp windows-entry.sh /
|
|
ENTRYPOINT ["/windows-entry.sh"]
|
|
|
|
RUN cp toolchain.cmake /opt/toolchain.cmake
|
|
|
|
# for why we always link with pthread support, see:
|
|
# https://github.com/cross-rs/cross/pull/1123#issuecomment-1312287148
|
|
ENV CROSS_TOOLCHAIN_PREFIX=x86_64-w64-mingw32-
|
|
ENV CROSS_TOOLCHAIN_SUFFIX=-posix
|
|
ENV CROSS_SYSROOT=/usr/x86_64-w64-mingw32
|
|
ENV CROSS_TARGET_RUNNER="env -u CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER wine"
|
|
ENV CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc"$CROSS_TOOLCHAIN_SUFFIX" \
|
|
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER="$CROSS_TARGET_RUNNER" \
|
|
AR_x86_64_pc_windows_gnu="$CROSS_TOOLCHAIN_PREFIX"ar \
|
|
CC_x86_64_pc_windows_gnu="$CROSS_TOOLCHAIN_PREFIX"gcc"$CROSS_TOOLCHAIN_SUFFIX" \
|
|
CXX_x86_64_pc_windows_gnu="$CROSS_TOOLCHAIN_PREFIX"g++"$CROSS_TOOLCHAIN_SUFFIX" \
|
|
CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_gnu=/opt/toolchain.cmake \
|
|
BINDGEN_EXTRA_CLANG_ARGS_x86_64_pc_windows_gnu="--sysroot=$CROSS_SYSROOT -idirafter/usr/include" \
|
|
CROSS_CMAKE_SYSTEM_NAME=Windows \
|
|
CROSS_CMAKE_SYSTEM_PROCESSOR=AMD64 \
|
|
CROSS_CMAKE_CRT=gnu \
|
|
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -m64"
|