From a8736e8ea2b54f2e1937a6eb492a13665a58d0c7 Mon Sep 17 00:00:00 2001 From: Andrey Orlov Date: Mon, 21 Mar 2022 19:27:10 +0400 Subject: [PATCH] Create a CI job to build a docker image of composablefi/mmr-polkadot --- .github/workflows/mmr-polkadot.yml | 49 +++++++++++++++++++ Makefile | 11 ++++- Makefile.toml | 7 +++ docker/composable-sandbox.dockerfile | 2 +- ...olkadot.docker => mmr-polkadot.dockerfile} | 0 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/mmr-polkadot.yml rename docker/{mmr-polkadot.docker => mmr-polkadot.dockerfile} (100%) diff --git a/.github/workflows/mmr-polkadot.yml b/.github/workflows/mmr-polkadot.yml new file mode 100644 index 00000000000..70cfefbaf11 --- /dev/null +++ b/.github/workflows/mmr-polkadot.yml @@ -0,0 +1,49 @@ +name: "mmr-polkadot Docker image" + +on: + workflow_dispatch: + push: + branches: + - mmr-polkadot + +env: + DOCKER_USER_OPTION: '$UID:$GID' + SCCACHE_GCS_BUCKET: 'composable-build-artefacts' + RUSTC_WRAPPER: "/home/runner/.cargo/bin/sccache" + SCCACHE_GCS_RW_MODE: "READ_WRITE" + +jobs: + build-and-publish: + runs-on: + - self-hosted + - linux + - x64 + - sre + concurrency: + group: docker-${{ 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 + + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Build Docker image + run: make containerize-mmr-polkadot + + - name: Docker push + run: make push-mmr-polkadot diff --git a/Makefile b/Makefile index 4535bfd89d9..c065192ae5e 100644 --- a/Makefile +++ b/Makefile @@ -86,6 +86,14 @@ push-composable-sandbox: @docker push ${REPO}/composable-sandbox:${COMMIT_SHA} @docker push ${REPO}/composable-sandbox:latest +containerize-mmr-polkadot: + @docker build -f docker/mmr-polkadot.dockerfile \ + -t ${REPO}/mmr-polkadot:latest \ + . + +push-mmr-polkadot: + @docker push ${REPO}/mmr-polkadot:latest + containerize-ci-linux: @docker build -f docker/ci-linux.dockerfile \ -t ${REPO}/ci-linux:production \ @@ -107,7 +115,8 @@ endif .PHONY: build test docs style-check lint udeps containerize dev push install stop containerize-release push-release -.PHONY: containerize-composable-sandbox push-composable-sandbox containerize-ci-linux push-ci-linux +.PHONY: containerize-composable-sandbox push-composable-sandbox containerize-mmr-polkadot push-mmr-polkadot +.PHONY: containerize-ci-linux push-ci-linux #---------------------------------------------------------------------- # UTILITY FUNCTIONS TO remove diff --git a/Makefile.toml b/Makefile.toml index 6b9b84dd875..4633dfb3917 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -37,6 +37,13 @@ docker run --rm -ti -u$(id -u):$(id -g) -p9944:9944 -p9988:9988 -p9998:9998 comp ''' workspace = false +[tasks.remove-composable-sandbox-image] +dependencies = [] +script = ''' +docker rmi composablefi/composable-sandbox:latest +''' +workspace = false + [tasks.run-local-integration-tests] script = ''' # we cannot use toolchain setting as different parts of codebase require different compiler diff --git a/docker/composable-sandbox.dockerfile b/docker/composable-sandbox.dockerfile index 095be481735..cde2f3439c4 100644 --- a/docker/composable-sandbox.dockerfile +++ b/docker/composable-sandbox.dockerfile @@ -20,7 +20,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends apt-utils ca-ce # ===== SECOND STAGE ====== -FROM andor/mmr-polkadot:v0.9.17 as mmr-polkadot +FROM composablefi/mmr-polkadot:latest as mmr-polkadot FROM debian:11-slim diff --git a/docker/mmr-polkadot.docker b/docker/mmr-polkadot.dockerfile similarity index 100% rename from docker/mmr-polkadot.docker rename to docker/mmr-polkadot.dockerfile