Skip to content

Commit

Permalink
create a docker build process for grandpa-cw contract (#456)
Browse files Browse the repository at this point in the history
* create a docker build process for grandpa-cw contract

* add comments

* minor fixes

---------

Co-authored-by: rjonczy <[email protected]>
  • Loading branch information
blasrodri and rjonczy authored Nov 21, 2023
1 parent 7c3496d commit f1b4b27
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/grandpa-cw-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: "Build and publish Grandpa Docker image"

on:
push:
tags:
- '*cosmos*'

env:
IMAGE_NAME: "composablefi/grandpa-cw"

jobs:

build-and-publish:

name: Build & push docker image

runs-on: ubuntu-latest

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 f1b4b27

Please sign in to comment.