From 97df580f38b4c8a5065d7e2246a93569bfcc5c10 Mon Sep 17 00:00:00 2001 From: Anmol1696 Date: Wed, 27 Dec 2023 16:17:00 +0530 Subject: [PATCH] create debian non static docker-image --- .github/workflows/docker-debian.yaml | 78 ++++++++++++++++++++++++++++ Dockerfile.debian | 24 +++++++++ 2 files changed, 102 insertions(+) create mode 100644 .github/workflows/docker-debian.yaml create mode 100644 Dockerfile.debian diff --git a/.github/workflows/docker-debian.yaml b/.github/workflows/docker-debian.yaml new file mode 100644 index 00000000..ab32d336 --- /dev/null +++ b/.github/workflows/docker-debian.yaml @@ -0,0 +1,78 @@ +name: Docker + +on: + push: + branches: + - main + - anmol/docker-debian + tags: + - "v*.*.*" + pull_request: + branches: + - main + workflow_dispatch: + inputs: + tags: + description: "Tags to build and push" + required: true + type: string + +permissions: + contents: read + packages: write + +jobs: + build-push: + runs-on: ubuntu-latest + + env: + DOCKER_REGISTRY: ghcr.io + DOCKER_IMAGE: osmosis-labs/meshd + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: "1.21" + check-latest: true + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }} + tags: | + type=ref,event=branch + type=raw,value=latest,enable={{is_default_branch}} + type=semver,pattern=v{{major}}.{{minor}} + type=semver,pattern={{version}},value=v${{ inputs.tags }},enable=${{ inputs.tags != '' }} + flavor: | + latest=false + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Run go vendor + run: | + cd demo/ && go mod vendor + + - name: Publish to GitHub Packages + uses: docker/build-push-action@v4 + with: + platforms: linux/amd64 #,linux/arm64 (removing for debugging) + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + file: Dockerfile.debian diff --git a/Dockerfile.debian b/Dockerfile.debian new file mode 100644 index 00000000..92480dfb --- /dev/null +++ b/Dockerfile.debian @@ -0,0 +1,24 @@ +FROM golang:1.21-bookworm AS go-builder + +RUN apt-get update && \ + apt-get install -y ca-certificates wget make git file libc6-dev clang gcc build-essential + +WORKDIR /code + +# Download dependencies and CosmWasm libwasmvm if found. +ADD demo/go.mod demo/go.sum ./ + +#ADD https://github.com/CosmWasm/wasmvm/releases/download/v$wasmvm/libwasmvm_muslc.$arch.a /lib/libwasmvm_muslc.$arch.a +## Download +RUN set -eux; \ + WASM_VERSION=v$(go list -m github.com/CosmWasm/wasmvm | cut -d" " -f2 | cut -d"v" -f2); \ + echo $WASM_VERSION; \ + wget -O /lib/libwasmvm_muslc.a https://github.com/CosmWasm/wasmvm/releases/download/${WASM_VERSION}/libwasmvm_muslc.$(uname -m).a + +# Copy over code +COPY . /code + +# force it to use static lib (from above) not standard libgo_cosmwasm.so file +# then log output of file /code/bin/meshd +# then ensure static linking +RUN cd demo/ && LEDGER_ENABLED=false BUILD_TAGS=muslc make build