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

create a docker build process for grandpa-cw contract #456

Merged
merged 3 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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*'
blasrodri marked this conversation as resolved.
Show resolved Hide resolved

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

jobs:

build-and-publish:

name: Build & push docker image

runs-on:
- self-hosted
- x64-monster
blasrodri marked this conversation as resolved.
Show resolved Hide resolved

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 }}
blasrodri marked this conversation as resolved.
Show resolved Hide resolved
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
blasrodri marked this conversation as resolved.
Show resolved Hide resolved
Loading