-
Notifications
You must be signed in to change notification settings - Fork 28
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
2 changed files
with
122 additions
and
0 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,61 @@ | ||
name: deb_release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
build: | ||
name: Docker images for ghcr.io | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
DOCKER_REGISTRY: ghcr.io | ||
DOCKER_IMAGE_BASE: ${{ github.repository }} | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to the registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.DOCKER_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Deb package | ||
|
||
- name: Prover&Verifier image tags & labels | ||
id: meta-all | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }} | ||
- name: Prover&Verifier image build & push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: deb/Dockerfile | ||
push: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
tags: ${{ steps.meta-all.outputs.tags }} | ||
labels: ${{ steps.meta-all.coutputs.labels }} | ||
|
||
- name: Extract deb from Docker image | ||
run: | | ||
container_id=$(docker create ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}:pr-3) | ||
docker cp $container_id:/usr/bin/stone-prover.deb /tmp/stone-prover.deb | ||
docker rm $container_id | ||
- name: Verify file existence#2 | ||
run: ls -l /tmp/stone-prover.deb | ||
|
||
- name: Upload files to a GitHub release | ||
id: create_release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: /tmp/stone-prover.deb |
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,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"] |