Skip to content

Commit

Permalink
ci: add github workflow for docker build & publish (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmountaintop authored Oct 9, 2024
1 parent 2771810 commit d11ecc6
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/
38 changes: 38 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Docker Build and Push

on:
push:
tags:
- '*'

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push cloud Docker image
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile.cloud
push: true
tags: scrolltech/sdk-cloud-prover:${{ github.ref_name }},scrolltech/sdk-cloud-prover:latest

# - name: Build and push local Docker image
# uses: docker/build-push-action@v4
# with:
# context: .
# file: docker/Dockerfile.local
# push: true
# tags: scrolltech/sdk-local-prover:${{ github.ref_name }},scrolltech/sdk-local-prover:latest
23 changes: 23 additions & 0 deletions docker/Dockerfile.cloud
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Use the official Rust image as the base image
FROM scrolltech/go-rust-builder:go-1.21-rust-nightly-2023-12-03 as builder

# Set the working directory
WORKDIR /usr/src/app

# Copy the entire project
COPY . .

# Build the project
RUN cargo build --release --example cloud

# Create a new stage with a minimal Ubuntu image
FROM ubuntu:20.04

# Install necessary dependencies
RUN apt-get update && apt-get install -y libssl-dev && rm -rf /var/lib/apt/lists/*

# Copy the built binary from the builder stage
COPY --from=builder /usr/src/app/target/release/examples/cloud /usr/local/bin/cloud

# Set the entrypoint
ENTRYPOINT ["cloud"]

0 comments on commit d11ecc6

Please sign in to comment.