Skip to content

Commit

Permalink
CI: Add docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
dmirgaleev authored and Zaariel91 committed Jul 6, 2024
1 parent e865e0d commit 50af7e5
Show file tree
Hide file tree
Showing 10 changed files with 445 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Build
on:
push:
branches:
- 'master'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'master'

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 }}

# Prover and Verifier

- 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: 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 }}


# Prover

- name: Prover image tags & labels
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}-prover
- name: Prover image build & push
uses: docker/build-push-action@v3
with:
context: .
file: air_prover/Dockerfile
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.coutputs.labels }}

# Verifier

- name: Verifier image tags & labels
id: meta-ver
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}-verifier
- name: Verifier image build & push
uses: docker/build-push-action@v3
with:
context: .
file: air_verifier/Dockerfile
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta-ver.outputs.tags }}
labels: ${{ steps.meta-ver.coutputs.labels }}
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Stage 1: Base Image
FROM ciimage/python:3.9 AS base_image

# Install necessary dependencies including git
RUN apt-get update && apt-get install -y git

# 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

# Change ownership of the /app directory
RUN chown -R starkware:starkware /app

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

# Stage 2: Target Image
FROM debian:stable-slim AS target

# Copy the built binary from the base image to the target image
COPY --from=base_image /app/prover/build/bazelbin/src/starkware/main/cpu/cpu_air_prover /usr/bin/
# Uncomment the following line if you need to copy the verifier as well
COPY --from=base_image /app/prover/build/bazelbin/src/starkware/main/cpu/cpu_air_verifier /usr/bin/

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

# Set the entry point for the container
#ENTRYPOINT ["cpu_air_prover"]
35 changes: 35 additions & 0 deletions air_prover/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Stage 1: Base Image
FROM ciimage/python:3.9 AS base_image

# Install necessary dependencies including git
RUN apt-get update && apt-get install -y git

# 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

# Change ownership of the /app directory
RUN chown -R starkware:starkware /app

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

# Stage 2: Target Image
FROM debian:stable-slim AS target

# Copy the built binary from the base image to the target image
COPY --from=base_image /app/prover/build/bazelbin/src/starkware/main/cpu/cpu_air_prover /usr/bin/
# Uncomment the following line if you need to copy the verifier as well
# COPY --from=base_image /app/prover/bazel-bin/src/starkware/main/cpu/cpu_air_verifier /usr/bin/

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

# Set the entry point for the container
ENTRYPOINT ["cpu_air_prover"]
35 changes: 35 additions & 0 deletions air_verifier/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Stage 1: Base Image
FROM ciimage/python:3.9 AS base_image

# Install necessary dependencies including git
RUN apt-get update && apt-get install -y git

# 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

# Change ownership of the /app directory
RUN chown -R starkware:starkware /app

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

# Stage 2: Target Image
FROM debian:stable-slim AS target

# Copy the built binary from the base image to the target image
#COPY --from=base_image /app/prover/build/bazelbin/src/starkware/main/cpu/cpu_air_prover /usr/bin/
# Uncomment the following line if you need to copy the verifier as well
COPY --from=base_image /app/prover/build/bazelbin/src/starkware/main/cpu/cpu_air_verifier /usr/bin/

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

# Set the entry point for the container
ENTRYPOINT ["cpu_air_verifier"]
17 changes: 17 additions & 0 deletions test_files/cpu_air_params.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"field": "PrimeField0",
"stark": {
"fri": {
"fri_step_list": [
0,
4,
3
],
"last_layer_degree_bound": 64,
"n_queries": 18,
"proof_of_work_bits": 24
},
"log_n_cosets": 4
},
"use_extension_field": false
}
9 changes: 9 additions & 0 deletions test_files/cpu_air_prover_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"cached_lde_config": {
"store_full_lde": false,
"use_fft_for_eval": false
},
"constraint_polynomial_task_size": 256,
"n_out_of_memory_merkle_layers": 1,
"table_prover_n_tasks_per_segment": 32
}
Binary file added test_files/fibonacci_memory.json
Binary file not shown.
7 changes: 7 additions & 0 deletions test_files/fibonacci_private_input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trace_path": "/home/zaariel/stone-prover/test_files/fibonacci_trace.json",
"memory_path": "/home/zaariel/stone-prover/test_files/fibonacci_memory.json",
"pedersen": [],
"range_check": [],
"ecdsa": []
}
Loading

0 comments on commit 50af7e5

Please sign in to comment.