From 386cdbe1bcf2dbebea2b119d867f3faf712e5faf Mon Sep 17 00:00:00 2001 From: agnik Date: Wed, 2 Oct 2024 23:34:49 +0530 Subject: [PATCH] dockerfile update --- Dockerfile | 70 +++++++++++++++++++++--------------------------------- 1 file changed, 27 insertions(+), 43 deletions(-) diff --git a/Dockerfile b/Dockerfile index d9d0e9a..cf86bcc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"]