Skip to content

Commit

Permalink
fix dockerfiles everywhere, add axelar to github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
felichita committed Jun 18, 2024
1 parent fe12854 commit 43f3285
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 32 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/axelar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and Push Axelar Docker Image

on:
push:
tags:
- "axelar-v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
INFRA_TOOLKIT: v0.1.6

jobs:
build-and-push-axelar:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.21'

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Build Heighliner binary
run: |
go build -o heighliner
- name: Extract version from tag
id: extract_version
run: echo "VERSION=${GITHUB_REF#refs/tags/axelar-}" >> $GITHUB_ENV

- name: Manually pull the base Docker image
run: |
echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker pull ghcr.io/p2p-org/cosmos-heighliner:infra-toolkit-v0.1.6
- name: Build and push Axelar Docker image
run: |
./heighliner build -c axelar --alpine-version 3.18 --git-ref ${{ env.VERSION }}
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,22 @@ Docker image `somegaia:v8.0.0-somefork` will be built and stored in your local d

```shell
# docker login ...
heighliner build -r ghcr.io/p2p-org/heighliner -c gaia -g v6.0.0
heighliner build -r ghcr.io/p2p-org/cosmos-heighliner -c gaia -g v6.0.0
```

Docker image `ghcr.io/p2p-org/heighliner/gaia:v6.0.0` will be built and pushed to ghcr.io
Docker image `ghcr.io/p2p-org/cosmos-heighliner/gaia:v6.0.0` will be built and pushed to ghcr.io

#### Example: build and push last n releases of osmosis chain

```shell
# docker login ...
heighliner build -r ghcr.io/p2p-org/heighliner -c osmosis -n 3
heighliner build -r ghcr.io/p2p-org/cosmos-heighliner -c osmosis -n 3
```

heighliner will fetch the last 3 osmosis release tags from github, build docker images, and push them, e.g.:
- `ghcr.io/p2p-org/heighliner/osmosis:v6.1.0`
- `ghcr.io/p2p-org/heighliner/osmosis:v6.0.0`
- `ghcr.io/p2p-org/heighliner/osmosis:v5.0.0`
- `ghcr.io/p2p-org/cosmos-heighliner/osmosis:v6.1.0`
- `ghcr.io/p2p-org/cosmos-heighliner/osmosis:v6.0.0`
- `ghcr.io/p2p-org/cosmos-heighliner/osmosis:v5.0.0`

#### Example: build and push last n releases of all chains

Expand All @@ -114,7 +114,7 @@ This will make a request to each chain's Github repository to fetch all recent r
```shell
# docker login ...
export GH_USER=github_username GH_PAT=github_personal_access_token
heighliner build -r ghcr.io/p2p-org/heighliner -n 3
heighliner build -r ghcr.io/p2p-org/cosmos-heighliner -n 3
```

heighliner will fetch the last 3 release tags from github for all chains in [chains.yaml](./chains.yaml), build docker images, and push them.
Expand Down Expand Up @@ -143,7 +143,7 @@ Docker images for `heighliner/gaia:v7.0.1` will now be available in your local d
#### Example: Use custom buildkit server, build x64 and arm64 docker images for gaia v7.0.1, and push:

```shell
heighliner build -b --buildkit-addr tcp://192.168.1.5:8125 -c gaia -g v7.0.1 -r ghcr.io/p2p-org/heighliner
heighliner build -b --buildkit-addr tcp://192.168.1.5:8125 -c gaia -g v7.0.1 -r ghcr.io/p2p-org/cosmos-heighliner
```

Docker images for `heighliner/gaia:v7.0.1` will be built on the remote buildkit server and then pushed to the container repository. The manifest for the tag will contain both amd64 and arm64 images.
Expand Down
17 changes: 2 additions & 15 deletions chains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,27 +180,14 @@
github-organization: axelarnetwork
github-repo: axelar-core
dockerfile: cosmos
build-env:
- BUILD_TAGS=muslc
binaries:
- bin/axelard
build-target: |
set -eux
apk add --update nodejs npm jq py3-pip
CONTRACT_VERSION=$(cat contract-version.json | jq -r '.gateway')
git clone -b ${CONTRACT_VERSION} --single-branch https://github.com/axelarnetwork/axelar-cgp-solidity.git
cd axelar-cgp-solidity
# The npm commands will complain about nodejs versions but will proceed.
# See issue: https://github.com/p2p-org/heighliner/issues/92
npm ci
npm run build
# prettier + alpine + certain versions of the flatten-contracts scripts fail during prettier write, which is not fully necessary since hardhat flatten still outputs artifacts
sed -i '/prettier/d' scripts/flatten-contracts.sh
npm run flatten
mkdir -p ../contract-artifacts/gateway
mv artifacts/* ../contract-artifacts/
cd ..
VERSION=$(echo $(git describe --tags) | sed 's/^v//')
COMMIT=$(git log -1 --format='%H')
BUILD_TAGS=muslc
LDFLAGS="$LDFLAGS -X github.com/cosmos/cosmos-sdk/version.Name=axelar \
-X github.com/cosmos/cosmos-sdk/version.AppName=axelard \
-X github.com/cosmos/cosmos-sdk/version.Version=$VERSION \
Expand Down
2 changes: 1 addition & 1 deletion dockerfile/avalanche/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ RUN bash -c 'set -eux;\
LIBRARIES_ARR=($LIBRARIES_ENV); for LIBRARY in "${LIBRARIES_ARR[@]}"; do cp $LIBRARY /root/lib/; done'

# Use minimal busybox from infra-toolkit image for final scratch image
FROM ghcr.io/p2p-org/cosmos-infra-toolkit:v0.1.6 AS infra-toolkit
FROM ghcr.io/p2p-org/cosmos-heighliner:infra-toolkit-v0.1.6 AS infra-toolkit
RUN addgroup --gid 1111 -S p2p && adduser --uid 1111 -S p2p -G p2p

# Use ln and rm from full featured busybox for assembling final image
Expand Down
2 changes: 1 addition & 1 deletion dockerfile/avalanche/native.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ RUN bash -c 'set -eux;\
LIBRARIES_ARR=($LIBRARIES_ENV); for LIBRARY in "${LIBRARIES_ARR[@]}"; do cp $LIBRARY /root/lib/; done'

# Use minimal busybox from infra-toolkit image for final scratch image
FROM ghcr.io/p2p-org/cosmos-infra-toolkit:v0.1.6 AS infra-toolkit
FROM ghcr.io/p2p-org/cosmos-heighliner:infra-toolkit-v0.1.6 AS infra-toolkit
RUN addgroup --gid 1111 -S p2p && adduser --uid 1111 -S p2p -G p2p

# Use ln and rm from full featured busybox for assembling final image
Expand Down
2 changes: 1 addition & 1 deletion dockerfile/cargo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ RUN bash -c 'set -eux;\
done'

# Use minimal busybox from infra-toolkit image for final scratch image
FROM ghcr.io/p2p-org/cosmos-infra-toolkit:v0.1.6 AS infra-toolkit
FROM ghcr.io/p2p-org/cosmos-heighliner:infra-toolkit-v0.1.6 AS infra-toolkit
RUN addgroup --gid 1111 -S p2p && adduser --uid 1111 -S p2p -G p2p

# Use ln and rm from full featured busybox for assembling final image
Expand Down
2 changes: 1 addition & 1 deletion dockerfile/cargo/native.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ RUN bash -c 'set -eux;\
done'

# Use minimal busybox from infra-toolkit image for final scratch image
FROM ghcr.io/p2p-org/cosmos-infra-toolkit:v0.1.6 AS infra-toolkit
FROM ghcr.io/p2p-org/cosmos-heighliner:infra-toolkit-v0.1.6 AS infra-toolkit
RUN addgroup --gid 1111 -S p2p && adduser --uid 1111 -S p2p -G p2p

# Use ln and rm from full featured busybox for assembling final image
Expand Down
2 changes: 1 addition & 1 deletion dockerfile/cosmos/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ RUN bash -c 'set -eux;\
LIBRARIES_ARR=($LIBRARIES_ENV); for LIBRARY in "${LIBRARIES_ARR[@]}"; do cp $LIBRARY /root/lib/; done'

# Use minimal busybox from infra-toolkit image for final scratch image
FROM ghcr.io/p2p-org/cosmos-infra-toolkit:v0.1.6 AS infra-toolkit
FROM ghcr.io/p2p-org/cosmos-heighliner:infra-toolkit-v0.1.6 AS infra-toolkit
RUN addgroup --gid 1111 -S p2p && adduser --uid 1111 -S p2p -G p2p

# Use ln and rm from full featured busybox for assembling final image
Expand Down
2 changes: 1 addition & 1 deletion dockerfile/cosmos/local.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ RUN set -eux; \
fi;

# Use minimal busybox from infra-toolkit image for final scratch image
FROM ghcr.io/p2p-org/cosmos-infra-toolkit:v0.1.6 AS infra-toolkit
FROM ghcr.io/p2p-org/cosmos-heighliner:infra-toolkit-v0.1.6 AS infra-toolkit
RUN addgroup --gid 1111 -S p2p && adduser --uid 1111 -S p2p -G p2p

# Use ln and rm from full featured busybox for assembling final image
Expand Down
2 changes: 1 addition & 1 deletion dockerfile/cosmos/localcross.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ RUN bash -c 'set -eux;\
LIBRARIES_ARR=($LIBRARIES_ENV); for LIBRARY in "${LIBRARIES_ARR[@]}"; do cp $LIBRARY /root/lib/; done'

# Use minimal busybox from infra-toolkit image for final scratch image
FROM ghcr.io/p2p-org/cosmos-infra-toolkit:v0.1.6 AS infra-toolkit
FROM ghcr.io/p2p-org/cosmos-heighliner:infra-toolkit-v0.1.6 AS infra-toolkit
RUN addgroup --gid 1111 -S p2p && adduser --uid 1111 -S p2p -G p2p

# Use ln and rm from full featured busybox for assembling final image
Expand Down
2 changes: 1 addition & 1 deletion dockerfile/cosmos/native.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ RUN bash -c 'set -eux;\
LIBRARIES_ARR=($LIBRARIES_ENV); for LIBRARY in "${LIBRARIES_ARR[@]}"; do cp $LIBRARY /root/lib/; done'

# Use minimal busybox from infra-toolkit image for final scratch image
FROM ghcr.io/p2p-org/cosmos-infra-toolkit:v0.1.6 AS infra-toolkit
FROM ghcr.io/p2p-org/cosmos-heighliner:infra-toolkit-v0.1.6 AS infra-toolkit
RUN addgroup --gid 1111 -S p2p && adduser --uid 1111 -S p2p -G p2p

# Use ln and rm from full featured busybox for assembling final image
Expand Down
2 changes: 1 addition & 1 deletion dockerfile/imported/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG VERSION
FROM $BASE_IMAGE:$VERSION AS imported

# Use minimal busybox from infra-toolkit image for final scratch image
FROM ghcr.io/p2p-org/cosmos-infra-toolkit:v0.1.6 AS infra-toolkit
FROM ghcr.io/p2p-org/cosmos-heighliner:infra-toolkit-v0.1.6 AS infra-toolkit
RUN addgroup --gid 1111 -S p2p && adduser --uid 1111 -S p2p -G p2p

# Use ln and rm from full featured busybox for assembling final image
Expand Down

0 comments on commit 43f3285

Please sign in to comment.