Skip to content

Commit

Permalink
Fix docker build (#657)
Browse files Browse the repository at this point in the history
* wip test

* new try

* wip again

* once again

* more fixeS

* fix

* more fixes
  • Loading branch information
girazoki authored Aug 22, 2024
1 parent 59337ef commit a5f1925
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cancel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ jobs:
steps:
- uses: styfle/[email protected]
with:
workflow_id: ".github/workflows/release.yml,.github/workflows/coverage.yml"
workflow_id: ".github/workflows/release.yml,.github/workflows/coverage.yml,.github/workflows/docker-runtime-draft.yml"
all_but_latest: true
access_token: ${{ github.token }}
109 changes: 109 additions & 0 deletions .github/workflows/docker-runtime-draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Push Runtime Draft Docker

# The code compile in non-fast mode the runtime and pushes to docker
on:
push:
branches:
- perm-runtime-*

jobs:
####### Building binaries #######
setup-scripts:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Upload tools
uses: actions/upload-artifact@v4
with:
name: original-tools
path: tools

build-binary:
needs: ["setup-scripts"]
runs-on: self-hosted
strategy:
matrix:
cpu: ["", "skylake", "znver3"]
env:
RUSTFLAGS: "-C target-cpu=${{ matrix.cpu }}"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.to }}
- name: Setup Rust toolchain
run: rustup show
- name: Build Node
run: cargo build --profile=production --all

- name: Save parachain binary
if: ${{ matrix.cpu == '' }}
run: |
mkdir -p binaries
cp target/production/tanssi-node binaries/tanssi-node
cp target/production/container-chain-frontier-node binaries/container-chain-frontier-node
cp target/production/container-chain-simple-node binaries/container-chain-simple-node
- name: Save parachain custom binary
if: ${{ matrix.cpu != '' }}
run: |
mkdir -p binaries
cp target/production/tanssi-node binaries/tanssi-node-${{matrix.cpu}}
cp target/production/container-chain-frontier-node binaries/container-chain-frontier-node-${{matrix.cpu}}
cp target/production/container-chain-simple-node binaries/container-chain-simple-node-${{matrix.cpu}}
- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: binaries
path: binaries
docker-tanssi:
runs-on: ubuntu-latest
needs: ["build-binary"]
strategy:
fail-fast: false
matrix:
image: ["tanssi", "container-chain-simple-template", "container-chain-evm-template"]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: binaries
path: build
- name: Prepare
id: prep
run: |
SHA8=$(git log -1 --format='%H' | cut -c1-8)
DOCKER_IMAGE=moondancelabs/${{matrix.image}}
TAGS="${DOCKER_IMAGE}:sha-${SHA8}"
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver-opts: |
image=moby/buildkit:master
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/${{matrix.image}}.Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.prep.outputs.tags }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ jobs:
id: prep
run: |
DOCKER_IMAGE=moondancelabs/${{matrix.image}}
TAGS="${DOCKER_IMAGE}:sha-${{ needs.set-tags.outputs.sha8 }}"
TAGS="${DOCKER_IMAGE}:sha-${{ needs.set-tags.outputs.sha8 }}-fast-runtime"
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Set up QEMU
Expand Down

0 comments on commit a5f1925

Please sign in to comment.