From 3814ad0d23bcdcba99a231158fca58d26c41c435 Mon Sep 17 00:00:00 2001 From: gregnuj Date: Thu, 27 Jul 2023 12:38:08 -0500 Subject: [PATCH] add cosmwasm image --- .github/workflows/base-docker.yml | 75 ++++++++++++++ .github/workflows/cw-builder-docker.yml | 124 ++++++++++++++++++++++++ cw-builder.Dockerfile | 26 +++++ 3 files changed, 225 insertions(+) create mode 100644 .github/workflows/base-docker.yml create mode 100644 .github/workflows/cw-builder-docker.yml create mode 100644 cw-builder.Dockerfile diff --git a/.github/workflows/base-docker.yml b/.github/workflows/base-docker.yml new file mode 100644 index 0000000..81280b4 --- /dev/null +++ b/.github/workflows/base-docker.yml @@ -0,0 +1,75 @@ +name: Docker Build + +on: + pull_request: + branches: + - main + - test + push: + branches: + - main + - test + tags: + - 'v*' + +jobs: + build-base: + + strategy: + matrix: + name: [alpine-base] + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v3 + + # https://docs.docker.com/build/ci/github-actions/multi-platform/ + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + # Workaround: https://github.com/docker/build-push-action/issues/461 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + + # https://github.com/docker/login-action + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USER }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Log in to the github container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + images: | + ghcr.io/${{ github.repository }}/${{ matrix.name }} + ${{ secrets.DOCKERHUB_USER }}/${{ matrix.name }} + tags: | + type=sha + type=edge,branch=test + type=semver,pattern={{tag}} + type=semver,pattern={{version}} + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build docker image + uses: docker/build-push-action@v4 + with: + push: ${{ github.event_name != 'pull_request' }} + file: ${{ matrix.name }}.Dockerfile + platforms: linux/amd64,linux/arm64 + tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }} + labels: ${{ env.DOCKER_METADATA_OUTPUT_LABELS }} diff --git a/.github/workflows/cw-builder-docker.yml b/.github/workflows/cw-builder-docker.yml new file mode 100644 index 0000000..b3453d0 --- /dev/null +++ b/.github/workflows/cw-builder-docker.yml @@ -0,0 +1,124 @@ +name: Docker Build + +on: + pull_request: + branches: + - main + - test + push: + branches: + - main + - test + tags: + - 'v*' + +jobs: + build-cosmwasm: + + strategy: + matrix: + platform: [linux/amd64,linux/arm64] + name: [ + "v1.3.0", + "v1.2.4", + "v1.2.3", + "v1.2.2", + "v1.2.1", + "v1.2.0", + "v1.1.2", + "v1.1.1", + "v1.1.0", + "v1.0.1", + "v1.0.0", + "v0.16.7", + "v0.16.6", + "v0.16.5", + "v0.16.3", + "v0.16.2", + "v0.16.1", + "v0.16.0", + "v0.15.1", + "v0.15.0", + "v0.14.0", + "v0.13.1", + "v0.13.0", + "v0.12.0", + ] + exclude: + - name: "v0.16.5" + platform: linux/amd64 + - name: "v0.16.3" + platform: linux/amd64 + - name: "v0.16.2" + platform: linux/amd64 + - name: "v0.16.1" + platform: linux/amd64 + - name: "v0.16.0" + platform: linux/amd64 + - name: "v0.15.1" + platform: linux/amd64 + - name: "v0.15.0" + platform: linux/amd64 + - name: "v0.14.0" + platform: linux/amd64 + - name: "v0.13.1" + platform: linux/amd64 + - name: "v0.13.0" + platform: linux/amd64 + - name: "v0.12.0" + platform: linux/amd64 + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v3 + + # https://docs.docker.com/build/ci/github-actions/multi-platform/ + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + # Workaround: https://github.com/docker/build-push-action/issues/461 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + + # https://github.com/docker/login-action + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USER }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Log in to the github container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + images: | + ghcr.io/${{ github.repository }}/${{ matrix.name }} + ${{ secrets.DOCKERHUB_USER }}/${{ matrix.name }} + tags: | + type=sha + type=edge,branch=test + type=semver,pattern={{tag}} + type=semver,pattern={{version}} + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build docker image + uses: docker/build-push-action@v4 + with: + push: ${{ github.event_name != 'pull_request' }} + file: ${{ matrix.name }}.Dockerfile + platforms: ${{ matrix.platform }} + tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }} + labels: ${{ env.DOCKER_METADATA_OUTPUT_LABELS }} diff --git a/cw-builder.Dockerfile b/cw-builder.Dockerfile new file mode 100644 index 0000000..fc2d424 --- /dev/null +++ b/cw-builder.Dockerfile @@ -0,0 +1,26 @@ +ARG IMG_TAG="latest" +ARG WASMVM_VERSION="1.3.0" +ARG BUILDPLATFORM="linux/amd64" +FROM --platform=${BUILDPLATFORM}} ghcr.io/terra-project/cosmos-docker-builds/alpine-base:${IMG_TAG} + +ARG BUILDPLATFORM + +# Cosmwasm - Download correct libwasmvm version +RUN set -eux &&\ + WASMVM_DOWNLOADS="https://github.com/CosmWasm/wasmvm/releases/download/${WASMVM_VERSION}"; \ + wget ${WASMVM_DOWNLOADS}/checksums.txt -O /tmp/checksums.txt; \ + if [ ${BUILDPLATFORM} = "linux/amd64" ]; then \ + wget ${WASMVM_DOWNLOADS}/libwasmvm_muslc.x86_64.a -O /lib/libwasmvm_muslc.a; \ + wget ${WASMVM_DOWNLOADS}/libwasmvm.x86_64.so -O /lib/libwasmvm.so; \ + elif [ ${BUILDPLATFORM} = "linux/arm64" ]; then \ + wget ${WASMVM_DOWNLOADS}/libwasmvm_muslc.aarch64.a -O /lib/libwasmvm_muslc.a; \ + wget ${WASMVM_DOWNLOADS}/libwasmvm.aarch64.so -O /lib/libwasmvm.so; \ + else \ + echo "Unsupported Build Platfrom ${BUILDPLATFORM}"; \ + exit 1; \ + fi; \ + CHECKSUM=`sha256sum /lib/libwasmvm_muslc.a | cut -d" " -f1`; \ + grep ${CHECKSUM} /tmp/checksums.txt; \ + CHECKSUM=`sha256sum /lib/libwasmvm.so | cut -d" " -f1`; \ + grep ${CHECKSUM} /tmp/checksums.txt; \ + rm /tmp/checksums.txt \ No newline at end of file