Skip to content

Commit

Permalink
add Dockerfile for create deb
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaariel91 committed Jul 17, 2024
1 parent bbb91f3 commit 156c3c8
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions deb/Dockefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Stage 1: Base Image
FROM ciimage/python:3.9 AS base_image

# Install necessary dependencies including git and build tools
RUN apt-get update && apt-get install -y git build-essential devscripts debhelper

# Clone the public prover repository
RUN git clone https://github.com/starkware-libs/stone-prover.git /app/prover

# Set the working directory to the cloned repository
WORKDIR /app/prover

# Run the installation scripts from the cloned repository
RUN /app/prover/install_deps.sh
RUN ./docker_common_deps.sh

# Build the project using Bazel
RUN bazel build //...

# Stage 2: Create DEB package
FROM base_image AS deb_package

# Install packaging tools
RUN apt-get update && apt-get install -y dh-make

# Set working directory to /app/deb
WORKDIR /app/deb

# Create the DEB package structure
RUN mkdir -p stone-prover/usr/bin
RUN cp /app/prover/build/bazelbin/src/starkware/main/cpu/cpu_air_prover stone-prover/usr/bin/
RUN cp /app/prover/build/bazelbin/src/starkware/main/cpu/cpu_air_verifier stone-prover/usr/bin/

# Create DEBIAN control files
RUN mkdir -p stone-prover/DEBIAN
RUN echo "Package: stone-prover" > stone-prover/DEBIAN/control
RUN echo "Version: 1.0" >> stone-prover/DEBIAN/control
RUN echo "Section: base" >> stone-prover/DEBIAN/control
RUN echo "Priority: optional" >> stone-prover/DEBIAN/control
RUN echo "Architecture: all" >> stone-prover/DEBIAN/control
RUN echo "Depends: libdw1" >> stone-prover/DEBIAN/control
RUN echo "Maintainer: Zaariel91 [email protected]" >> stone-prover/DEBIAN/control
RUN echo "Description: Stone prover deb" >> stone-prover/DEBIAN/control

# Build the DEB package
RUN dpkg-deb --build stone-prover

# Stage 3: Final Image to extract DEB package
FROM debian:stable-slim AS target

# Copy the DEB package from the previous stage
COPY --from=deb_package /app/deb/stone-prover.deb /app/stone-prover.deb

# Install the necessary runtime dependencies
RUN apt update && apt install -y libdw1

# Optional: Install the DEB package to test it
# RUN dpkg -i /app/stone-prover.deb

# Entry point to keep the container alive or perform other actions
CMD ["bash"]

0 comments on commit 156c3c8

Please sign in to comment.