forked from baking-bad/stone-prover
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
43 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 |
---|---|---|
@@ -1,64 +1,48 @@ | ||
# Stage 1: Build | ||
FROM fedora:latest AS build | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Install dependencies and handle package cache clean-up | ||
RUN dnf clean all && \ | ||
dnf makecache && \ | ||
dnf update -y && \ | ||
dnf install -y \ | ||
gcc \ | ||
gcc-c++ \ | ||
make \ | ||
python3-pip \ | ||
wget \ | ||
git \ | ||
elfutils-libelf-devel \ | ||
gmp-devel \ | ||
python3-devel \ | ||
clang \ | ||
libstdc++-devel \ | ||
libcxx \ | ||
libcxx-devel \ | ||
ncurses-compat-libs \ | ||
bazelisk && \ | ||
dnf clean all && \ | ||
rm -rf /var/cache/dnf | ||
# Install dependencies | ||
RUN dnf update -y && dnf install -y \ | ||
gcc gcc-c++ make python3-pip wget git \ | ||
elfutils-libelf-devel gmp-devel python3-devel \ | ||
clang libstdc++-devel libcxx libcxx-devel \ | ||
ncurses-compat-libs \ | ||
&& dnf clean all \ | ||
&& rm -rf /var/cache/dnf | ||
|
||
# Install Bazelisk (Bazel wrapper) | ||
RUN wget https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-linux-amd64 && \ | ||
chmod +x bazelisk-linux-amd64 && \ | ||
mv bazelisk-linux-amd64 /usr/local/bin/bazelisk | ||
# Install Bazelisk | ||
RUN wget https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-linux-amd64 \ | ||
&& chmod +x bazelisk-linux-amd64 \ | ||
&& mv bazelisk-linux-amd64 /usr/local/bin/bazelisk | ||
|
||
# Copy all project files into the container | ||
COPY . . | ||
|
||
# Build the project with Bazel using disk cache for better performance | ||
# Build with Bazel disk cache management | ||
RUN bazelisk build //... \ | ||
--disk_cache=/tmp/bazel-disk-cache \ | ||
--output_user_root=/tmp/bazel-user-root | ||
|
||
# Clean up build artifacts to reduce image size | ||
# Clean up to reduce image size | ||
RUN rm -rf /tmp/bazel-disk-cache /tmp/bazel-user-root | ||
|
||
# Stage 2: Target Image for Final Application | ||
# Stage 2: Test (New) | ||
FROM build AS test | ||
|
||
# Run tests | ||
RUN bazelisk test //... --cxxopt='-std=c++17' | ||
|
||
# Stage 3: Target Image | ||
FROM fedora:latest AS target | ||
|
||
# Copy the built binaries from the build stage | ||
COPY --from=build /app/bazel-bin/src/starkware/main/cpu/cpu_air_prover /usr/local/bin/ | ||
COPY --from=build /app/bazel-bin/src/starkware/main/cpu/cpu_air_verifier /usr/local/bin/ | ||
|
||
# Install the necessary runtime dependencies | ||
RUN dnf clean all && \ | ||
dnf makecache && \ | ||
dnf update -y && \ | ||
dnf install -y \ | ||
elfutils-libelf \ | ||
gmp \ | ||
libstdc++ && \ | ||
dnf clean all && \ | ||
rm -rf /var/cache/dnf | ||
# Install necessary runtime dependencies | ||
RUN dnf update -y && dnf install -y \ | ||
elfutils-libelf gmp libstdc++ \ | ||
&& dnf clean all \ | ||
&& rm -rf /var/cache/dnf | ||
|
||
# Ent | ||
ENTRYPOINT ["/bin/bash"] |