Skip to content

Commit 9128a8a

Browse files
authored
Add quorum docker setup (#2770)
1 parent 117981d commit 9128a8a

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

.github/workflows/docker-quorum.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build and Push Quorum Image
2+
on:
3+
push:
4+
tags:
5+
- quorum-v*
6+
pull_request:
7+
paths:
8+
- "apps/quorum/**"
9+
workflow_dispatch:
10+
inputs:
11+
dispatch_description:
12+
description: "Dispatch description"
13+
required: true
14+
type: string
15+
permissions:
16+
contents: read
17+
id-token: write
18+
packages: write
19+
env:
20+
REGISTRY: ghcr.io
21+
IMAGE_NAME: pyth-network/quorum
22+
jobs:
23+
quorum-image:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Set image tag to version of the git tag
28+
if: ${{ startsWith(github.ref, 'refs/tags/quorum-v') }}
29+
run: |
30+
PREFIX="refs/tags/quorum-"
31+
VERSION="${GITHUB_REF:${#PREFIX}}"
32+
echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
33+
- name: Set image tag to the git commit hash
34+
if: ${{ !startsWith(github.ref, 'refs/tags/quorum-v') }}
35+
run: |
36+
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7)
37+
echo "IMAGE_TAG=sha-${SHORT_SHA}" >> "${GITHUB_ENV}"
38+
- name: Log in to the Container registry
39+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
40+
with:
41+
registry: ${{ env.REGISTRY }}
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
- name: Extract metadata (tags, labels) for Docker
45+
id: metadata_quorum
46+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
47+
with:
48+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
49+
tags: |
50+
type=raw,value=${{ env.IMAGE_TAG }}
51+
- name: Build and push server docker image
52+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
53+
with:
54+
context: .
55+
file: "./apps/quorum/Dockerfile"
56+
push: ${{ github.event_name != 'pull_request' }}
57+
tags: ${{ steps.metadata_quorum.outputs.tags }}
58+
labels: ${{ steps.metadata_quorum.outputs.labels }}

apps/quorum/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM rust:1.87.0 AS build
2+
3+
# Install OS packages
4+
RUN apt-get update && apt-get install --yes \
5+
build-essential curl clang libssl-dev
6+
7+
# Build
8+
WORKDIR /src
9+
COPY ./apps/quorum apps/quorum
10+
11+
WORKDIR /src/apps/quorum
12+
13+
RUN --mount=type=cache,target=/root/.cargo/registry cargo build --release
14+
15+
# Copy artifacts from other images
16+
FROM debian:bookworm-slim
17+
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
18+
COPY --from=build /src/apps/quorum/target/release/quorum /usr/local/bin/

0 commit comments

Comments
 (0)