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

Add arm64 to docker publish workflow #1709

Merged
merged 19 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 9 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
- "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5

# Set concurrency for this workflow to cancel in-progress jobs if retriggered.
# The github.ref is only available when triggered by a PR so fall back to github.run_id for other cases.
# The github.run_id is unique for each run, giving each such invocation it's own unique concurrency group.
Expand All @@ -17,21 +17,23 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Go mod vendor
run: |
go mod vendor

- name: Prepare
id: prep
run: |
Expand All @@ -56,24 +58,28 @@ jobs:
created="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
echo "Setting output: created=$created"
echo "created=$created" >> "$GITHUB_OUTPUT"

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Publish to Docker Hub
uses: docker/build-push-action@v5
with:
context: .
target: run
build-args: |
VERSION=${{ steps.prep.outputs.version }}
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
iramiller marked this conversation as resolved.
Show resolved Hide resolved
file: docker/blockchain/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* Bump cometbft to v0.34.29 (from v0.34.28) [PR 1649](https://github.com/provenance-io/provenance/pull/1649).
* Add genesis/init for Marker module send deny list addresses. [#1660](https://github.com/provenance-io/provenance/issues/1660)
* Add automatic changelog entries for dependabot. [#1674](https://github.com/provenance-io/provenance/issues/1674)
* Add publishing of docker arm64 container builds [#1634](https://github.com/provenance-io/provenance/issues/1634)
* Ensure IBC marker has matching supply [#1706](https://github.com/provenance-io/provenance/issues/1706).

### Bug Fixes
Expand Down
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,8 @@ vendor:

# Full build inside a docker container for a clean release build
docker-build: vendor
ifeq ($(UNAME_M),x86_64)
docker build --build-arg VERSION=$(VERSION) --build-arg ARCH=$(UNAME_M) -t provenance-io/blockchain . -f docker/blockchain/Dockerfile
else
docker build --build-arg VERSION=$(VERSION) --build-arg ARCH=aarch64 -t provenance-io/blockchain . -f docker/blockchain/Dockerfile
endif
docker build --build-arg VERSION=$(VERSION) -t provenance-io/blockchain . -f docker/blockchain/Dockerfile


# Quick build using local environment and go platform target options.
docker-build-local: vendor
Expand Down
21 changes: 17 additions & 4 deletions docker/blockchain/Dockerfile
Taztingo marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM golang:1.20-bullseye as build
ARG VERSION
ARG ARCH=x86_64

WORKDIR /go/src/github.com/provenance-io/provenance

Expand All @@ -23,21 +22,35 @@ COPY Makefile sims.mk ./

# Build and install provenanced
ENV VERSION=$VERSION
RUN make VERSION=${VERSION} WITH_CLEVELDB=true install
RUN ARCH=$(uname -m) && \
if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "aarch64" ]; then \
echo "Unsupported architecture (required: x86_64 or aarch64): $ARCH"; \
exit 1; \
fi && \
echo "Building and installing provenance for Arch: $ARCH"; \
make VERSION=${VERSION} install

Taztingo marked this conversation as resolved.
Show resolved Hide resolved
###
FROM debian:bullseye-slim as run
ARG ARCH=x86_64
ENV LD_LIBRARY_PATH="/usr/local/lib"
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y curl jq libleveldb-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/


COPY --from=build /go/src/github.com/provenance-io/provenance/vendor/github.com/CosmWasm/wasmvm/internal/api/libwasmvm.$ARCH.so /usr/local/lib
COPY --from=build /go/src/github.com/provenance-io/provenance/vendor/github.com/CosmWasm/wasmvm/internal/api/libwasmvm.*.so /tmp
COPY --from=build /go/bin/provenanced /usr/bin/provenanced

RUN ARCH=$(uname -m) && \
if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "aarch64" ]; then \
echo "Unsupported architecture (required: x86_64 or aarch64): $ARCH"; \
exit 1; \
fi && \
cp /tmp/libwasmvm.$ARCH.so /usr/local/lib/. && \
rm /tmp/libwasmvm.*.so

ENV PIO_HOME=/home/provenance
WORKDIR /home/provenance

Expand Down