Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker #4

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: release

on:
release:
types: [created]

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

- name: Extract binary from Docker image
run: |
container_id=$(docker create ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}:pr-3)
docker cp $container_id:/usr/bin/cpu_air_prover /tmp/cpu_air_prover
docker cp $container_id:/usr/bin/cpu_air_verifier /tmp/cpu_air_verifier
docker rm $container_id

- name: Verify file existence#2
run: ls -l /tmp/cpu*

- name: Upload files to a GitHub release
uses: svenstaro/[email protected]
with:
file_glob: true
tag: ${{ github.ref }}
file: /tmp/cpu_air*
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
Loading