-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/cancun
- Loading branch information
Showing
30 changed files
with
356 additions
and
293 deletions.
There are no files selected for viewing
This file contains 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,4 @@ | ||
[build] | ||
# https://github.com/rust-lang/rust/pull/124129 | ||
# https://github.com/dtolnay/linkme/pull/88 | ||
rustflags = ["-Z", "linker-features=-lld"] |
This file contains 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,28 @@ | ||
# this is loosely based on `docker init`'s rust template. | ||
|
||
**/.DS_Store | ||
**/.classpath | ||
**/.dockerignore | ||
# **/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/charts | ||
**/docker-compose* | ||
**/compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
/bin | ||
/target | ||
LICENSE | ||
README.md |
This file contains 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 contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 contains 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,100 @@ | ||
# syntax=docker/dockerfile:1 | ||
# This is loosely based on `docker init`'s rust template. | ||
# For a completely clean build, run something like this: | ||
# ``` | ||
# docker build --build-arg=PROFILE=dev --no-cache | ||
# ``` | ||
|
||
############# | ||
# Build stage | ||
############# | ||
# - `/src` is the repo directory. | ||
# - `/artifacts` is $CARGO_TARGET_DIR. | ||
# - `/output` is where the binaries go. | ||
|
||
ARG BUILD_BASE=rustlang/rust:nightly-bullseye-slim | ||
FROM ${BUILD_BASE} AS build | ||
|
||
# Install build dependencies. | ||
RUN apt-get update && apt-get install -y \ | ||
# for jemalloc | ||
libjemalloc-dev \ | ||
libjemalloc2 \ | ||
make \ | ||
# for openssl | ||
libssl-dev \ | ||
pkg-config \ | ||
# clean the image | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ARG PROFILE=release | ||
# forward the docker argument so that the script below can read it | ||
ENV PROFILE=${PROFILE} | ||
|
||
# Build the application. | ||
RUN \ | ||
# mount the repository so we don't have to COPY it in | ||
--mount=type=bind,source=.,target=/src \ | ||
# cache artifacts and the cargo registry to speed up subsequent builds | ||
--mount=type=cache,target=/artifacts \ | ||
--mount=type=cache,target=/usr/local/cargo/registry/ \ | ||
# run the build | ||
<<EOF | ||
set -eux | ||
|
||
# need to change workdir instead of using --manifest-path because we need | ||
# .cargo/config.toml | ||
cd /src | ||
|
||
# use the cache mount | ||
# (we will not be able to to write to e.g `/src/target` because it is bind-mounted) | ||
CARGO_TARGET_DIR=/artifacts cargo build --locked "--profile=${PROFILE}" --all | ||
|
||
# narrow the find call to SUBDIR because if we just copy out all executables | ||
# we will break the cache invariant | ||
if [ "$PROFILE" = "dev" ]; then | ||
SUBDIR=debug # edge case | ||
else | ||
SUBDIR=$PROFILE | ||
fi | ||
|
||
# maxdepth because binaries are in the root | ||
# - other folders contain build scripts etc. | ||
mkdir /output | ||
find "/artifacts/$SUBDIR" \ | ||
-maxdepth 1 \ | ||
-type f \ | ||
-executable \ | ||
-not -name '*.so' \ | ||
-exec cp '{}' /output \; \ | ||
|
||
EOF | ||
|
||
################## | ||
# Final executable | ||
################## | ||
FROM debian:bullseye-slim AS final | ||
|
||
# Install runtime dependencies. | ||
RUN apt-get update && apt-get install -y \ | ||
ca-certificates \ | ||
libjemalloc2 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# this keeps this build target agnostic to the build profile | ||
COPY --from=build ["/output/rpc", "/output/leader", "/output/worker", "/output/verifier", "/usr/local/bin/"] | ||
|
||
# Create a non-privileged user that the app will run under. | ||
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user | ||
ARG UID=10001 | ||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/nonexistent" \ | ||
--shell "/sbin/nologin" \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
user | ||
USER user | ||
|
This file contains 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 contains 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
Binary file not shown.
This file contains 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
Oops, something went wrong.