Skip to content

Commit

Permalink
create a docker build process for grandpa-cw contract
Browse files Browse the repository at this point in the history
  • Loading branch information
blasrodri committed Nov 20, 2023
1 parent b5c735f commit 735099a
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/grandpa-cw-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: "Build and publish Grandpa Docker image"

on:
push:
branches:
- '*'
tags:
- 'v*'

env:
IMAGE_NAME: ${{ github.repository }}

jobs:

build-and-publish:

name: Build & push docker image

runs-on:
- self-hosted
- x64-monster

concurrency:
group: grandpa-cw-image-${{ github.ref }}
cancel-in-progress: true

strategy:
fail-fast: true

steps:
- name: Clean up
continue-on-error: true
run: |
sudo chown -R $USER:$USER $GITHUB_WORKSPACE
docker system prune --force --all --volumes
- name: Install dependencies
run: |
sudo apt-get install -y make build-essential
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=ref,event=branch
type=sha,prefix={{branch}}-
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
file: scripts/grandpa-cw.Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
15 changes: 15 additions & 0 deletions scripts/grandpa-cw.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM paritytech/ci-unified:bullseye-1.73.0-2023-05-23 as builder

WORKDIR /code

COPY . .

ENV PATH="/usr/local/protoc/bin:$PATH"

RUN curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.9/protoc-21.9-linux-x86_64.zip && \
unzip protoc-21.9-linux-x86_64.zip -d /usr/local/protoc && \
protoc --version


# The .wasm file will live in /code/target/wasm32-unknown-unknown/release/ics10_grandpa_cw.wasm
RUN RUSTFLAGS='-C link-arg=-s' cargo build -p ics10-grandpa-cw --target=wasm32-unknown-unknown --release --lib

0 comments on commit 735099a

Please sign in to comment.