-
Notifications
You must be signed in to change notification settings - Fork 129
chore: switch to building toolchain with dockerfiles instead of github actions #2407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
NathanFlurry
wants to merge
1
commit into
graphite-base/2407
from
04-26-chore_switch_to_building_toolchain_with_dockerfiles_instead_of_github_actions
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # syntax=docker/dockerfile:1.4 | ||
| FROM rust:1.82.0 | ||
|
|
||
| # Install dependencies | ||
| RUN apt-get update && apt-get install -y \ | ||
| musl-tools \ | ||
| libssl-dev \ | ||
| pkg-config \ | ||
| protobuf-compiler \ | ||
| ca-certificates \ | ||
| git-lfs \ | ||
| musl-dev \ | ||
| gcc-aarch64-linux-gnu \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install musl target for aarch64 | ||
| RUN rustup target add aarch64-unknown-linux-musl | ||
|
|
||
| # Set up OpenSSL for musl target | ||
| ENV SSL_VER=1.1.1w | ||
| RUN wget https://www.openssl.org/source/openssl-$SSL_VER.tar.gz \ | ||
| && tar -xzf openssl-$SSL_VER.tar.gz \ | ||
| && cd openssl-$SSL_VER \ | ||
| && ./Configure no-shared no-async --prefix=/musl-aarch64 --openssldir=/musl-aarch64/ssl linux-aarch64 \ | ||
| && make -j$(nproc) CC=aarch64-linux-gnu-gcc \ | ||
| && make install_sw \ | ||
| && cd .. \ | ||
| && rm -rf openssl-$SSL_VER* | ||
|
|
||
| # Configure OpenSSL env vars for the build | ||
| ENV OPENSSL_DIR=/musl-aarch64 \ | ||
| OPENSSL_INCLUDE_DIR=/musl-aarch64/include \ | ||
| OPENSSL_LIB_DIR=/musl-aarch64/lib \ | ||
| PKG_CONFIG_ALLOW_CROSS=1 \ | ||
| CC_aarch64_unknown_linux_musl=aarch64-linux-gnu-gcc \ | ||
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc | ||
|
|
||
| # Set environment variables | ||
| ENV CARGO_INCREMENTAL=0 \ | ||
| RUSTFLAGS="--cfg tokio_unstable" \ | ||
| CARGO_NET_GIT_FETCH_WITH_CLI=true | ||
|
|
||
| # Set working directory | ||
| WORKDIR /build | ||
|
|
||
| # Build CLI instructions | ||
| COPY . . | ||
|
|
||
| # Build for Linux with musl (static binary) | ||
| 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 --bin rivet --release --target aarch64-unknown-linux-musl -v && \ | ||
| mkdir -p /artifacts && \ | ||
| cp target/aarch64-unknown-linux-musl/release/rivet /artifacts/rivet-aarch64-linux | ||
|
|
||
| # Default command to show help | ||
| CMD ["ls", "-la", "/artifacts"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # syntax=docker/dockerfile:1.4 | ||
| FROM rust:1.82.0 | ||
|
|
||
| # Install dependencies | ||
| RUN apt-get update && apt-get install -y \ | ||
| musl-tools \ | ||
| libssl-dev \ | ||
| pkg-config \ | ||
| protobuf-compiler \ | ||
| ca-certificates \ | ||
| git-lfs \ | ||
| musl-dev \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install musl target | ||
| RUN rustup target add x86_64-unknown-linux-musl | ||
|
|
||
| # Set up OpenSSL for musl target | ||
| ENV SSL_VER=1.1.1w | ||
| RUN wget https://www.openssl.org/source/openssl-$SSL_VER.tar.gz \ | ||
| && tar -xzf openssl-$SSL_VER.tar.gz \ | ||
| && cd openssl-$SSL_VER \ | ||
| && ./Configure no-shared no-async --prefix=/musl --openssldir=/musl/ssl linux-x86_64 \ | ||
| && make -j$(nproc) \ | ||
| && make install_sw \ | ||
| && cd .. \ | ||
| && rm -rf openssl-$SSL_VER* | ||
|
|
||
| # Configure OpenSSL env vars for the build | ||
| ENV OPENSSL_DIR=/musl \ | ||
| OPENSSL_INCLUDE_DIR=/musl/include \ | ||
| OPENSSL_LIB_DIR=/musl/lib \ | ||
| PKG_CONFIG_ALLOW_CROSS=1 | ||
|
|
||
| # Set environment variables | ||
| ENV CARGO_INCREMENTAL=0 \ | ||
| RUSTFLAGS="--cfg tokio_unstable" \ | ||
| CARGO_NET_GIT_FETCH_WITH_CLI=true | ||
|
|
||
| # Set working directory | ||
| WORKDIR /build | ||
|
|
||
| # Build CLI instructions | ||
| COPY . . | ||
|
|
||
| # Build for Linux with musl (static binary) | ||
| 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 --bin rivet --release --target x86_64-unknown-linux-musl -v && \ | ||
| mkdir -p /artifacts && \ | ||
| cp target/x86_64-unknown-linux-musl/release/rivet /artifacts/rivet-x86-linux | ||
|
|
||
| # Default command to show help | ||
| CMD ["ls", "-la", "/artifacts"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # syntax=docker/dockerfile:1.4 | ||
| FROM rust:1.82.0 | ||
|
|
||
| # Install dependencies | ||
| RUN apt-get update && apt-get install -y \ | ||
| git-lfs \ | ||
| protobuf-compiler \ | ||
| clang \ | ||
| cmake \ | ||
| patch \ | ||
| libxml2-dev \ | ||
| wget \ | ||
| xz-utils \ | ||
| curl \ | ||
| && 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 | ||
|
|
||
| # Add osxcross to PATH | ||
| ENV PATH="/root/osxcross/target/bin:$PATH" | ||
|
|
||
| # Install macOS target | ||
| RUN rustup target add aarch64-apple-darwin | ||
|
|
||
| # Configure Cargo for cross-compilation | ||
| 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 | ||
|
|
||
| # Set environment variables for cross-compilation | ||
| ENV 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++ \ | ||
| MACOSX_DEPLOYMENT_TARGET=10.7 \ | ||
| # Skip aws-lc-rs with rustls certs config when building for macOS | ||
| RUSTFLAGS="--cfg tokio_unstable --cfg rustls_native_certs --cfg aws_lc_rs" \ | ||
| CARGO_FEATURE_RUSTLS_NATIVE_CERTS=0 \ | ||
| CARGO_RUSTLS_NATIVE_CERTS=0 \ | ||
| CARGO_INCREMENTAL=0 \ | ||
| CARGO_NET_GIT_FETCH_WITH_CLI=true | ||
|
|
||
| # Set working directory | ||
| WORKDIR /build | ||
|
|
||
| # Copy the source code | ||
| COPY . . | ||
|
|
||
| # Build for ARM64 macOS | ||
| 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 --bin rivet --release --target aarch64-apple-darwin && \ | ||
| mkdir -p /artifacts && \ | ||
| cp target/aarch64-apple-darwin/release/rivet /artifacts/rivet-aarch64-mac | ||
|
|
||
| # Default command to show help | ||
| CMD ["ls", "-la", "/artifacts"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # syntax=docker/dockerfile:1.4 | ||
| FROM rust:1.82.0 | ||
|
|
||
| # Install dependencies | ||
| RUN apt-get update && apt-get install -y \ | ||
| git-lfs \ | ||
| protobuf-compiler \ | ||
| clang \ | ||
| cmake \ | ||
| patch \ | ||
| libxml2-dev \ | ||
| wget \ | ||
| xz-utils \ | ||
| curl \ | ||
| && 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 | ||
|
|
||
| # Add osxcross to PATH | ||
| ENV PATH="/root/osxcross/target/bin:$PATH" | ||
|
|
||
| # Install macOS target | ||
| RUN rustup target add x86_64-apple-darwin | ||
|
|
||
| # Configure Cargo for cross-compilation | ||
| RUN mkdir -p /root/.cargo && \ | ||
| echo '\ | ||
| [target.x86_64-apple-darwin]\n\ | ||
| linker = "x86_64-apple-darwin20.4-clang"\n\ | ||
| ar = "x86_64-apple-darwin20.4-ar"\n\ | ||
| ' > /root/.cargo/config.toml | ||
|
|
||
| # Set environment variables for cross-compilation | ||
| ENV CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=x86_64-apple-darwin20.4-clang \ | ||
| CC_x86_64_apple_darwin=x86_64-apple-darwin20.4-clang \ | ||
| CXX_x86_64_apple_darwin=x86_64-apple-darwin20.4-clang++ \ | ||
| MACOSX_DEPLOYMENT_TARGET=10.7 \ | ||
| # Skip aws-lc-rs with rustls certs config when building for macOS | ||
| RUSTFLAGS="--cfg tokio_unstable --cfg rustls_native_certs --cfg aws_lc_rs" \ | ||
| CARGO_FEATURE_RUSTLS_NATIVE_CERTS=0 \ | ||
|
Comment on lines
+44
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: Setting both rustls_native_certs flag and CARGO_FEATURE_RUSTLS_NATIVE_CERTS=0 seems contradictory. Verify this configuration is intentional. |
||
| CARGO_RUSTLS_NATIVE_CERTS=0 \ | ||
| CARGO_INCREMENTAL=0 \ | ||
| CARGO_NET_GIT_FETCH_WITH_CLI=true | ||
|
|
||
| # Set working directory | ||
| WORKDIR /build | ||
|
|
||
| # Copy the source code | ||
| COPY . . | ||
|
|
||
| # Build for x86_64 macOS | ||
| 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 --bin rivet --release --target x86_64-apple-darwin && \ | ||
| mkdir -p /artifacts && \ | ||
| cp target/x86_64-apple-darwin/release/rivet /artifacts/rivet-x86-mac | ||
|
|
||
| # Default command to show help | ||
| CMD ["ls", "-la", "/artifacts"] | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider adding
no-deprecatedflag to OpenSSL Configure to reduce binary size and remove deprecated functions