Skip to content

Commit

Permalink
Build with platform arm (#132)
Browse files Browse the repository at this point in the history
* Build with platform arm

* Add arm platform for every build, force push from PR

* force push docker images

* Just build and not push: debug CI

* Update dockerfile for explorer and faucet

* add timeout to yarn install, increase max parallel for building docker images

* Remove versions of hermes without arm support

* Remove alpha versions of cosmjs faucet, force push on the CI again

* Add workflow dispatch to force push docker images, fix workflow

* Bump chart to v0.1.36 which is arm64 compatible
  • Loading branch information
Anmol1696 authored Jun 29, 2023
1 parent e578f3f commit 2400cee
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 23 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
matrix:
build-type: [ "explorers", "faucet", "relayers", "starship" ]
max-parallel: 2
max-parallel: 4

env:
DOCKER_REPO: ghcr.io/cosmology-tech/starship
Expand Down Expand Up @@ -54,10 +54,15 @@ jobs:
./scripts/build-docker.sh --type ${{ matrix.build-type }} --process all --version all
- name: Build and push
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
if: github.event_name == 'push'
run: |
./scripts/build-docker.sh --type ${{ matrix.build-type }} --process all --version all --push
- name: Force Build and Push for workflow dispatch
if: github.event_name == 'workflow_dispatch'
run: |
./scripts/build-docker.sh --type ${{ matrix.build-type }} --process all --version all --push --force
build-push-chains:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -90,6 +95,11 @@ jobs:
cd docker/chains && ./build-docker-chains.sh --chain all --tag all
- name: Build and push all chains
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
if: github.event_name == 'push'
run: |
cd docker/chains && ./build-docker-chains.sh --chain all --tag all --push
- name: Force Build and Push for workflow dispatch
if: github.event_name == 'workflow_dispatch'
run: |
cd docker/chains && ./build-docker-chains.sh --chain all --tag all --push --force
2 changes: 1 addition & 1 deletion charts/devnet/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.35
version: 0.1.36

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
4 changes: 2 additions & 2 deletions charts/devnet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ exposer:
memory: "200M"

faucet:
image: ghcr.io/cosmology-tech/starship/cosmjs-faucet:v0.30.1
image: ghcr.io/cosmology-tech/starship/cosmjs-faucet:v0.31.0
ports:
rest: 8000
resources:
Expand Down Expand Up @@ -348,7 +348,7 @@ explorer:
# Flag to enable explorer for cluster
enabled: false
type: ping-pub
image: ghcr.io/cosmology-tech/starship/ping-pub:6437369d84c374ee357370a219508948e605f7cc
image: ghcr.io/cosmology-tech/starship/ping-pub:6b7b0d096946b6bcd75d15350c7345da0d4576db
localhost: true
ports:
rest: 8080
Expand Down
12 changes: 11 additions & 1 deletion docker/chains/build-docker-chains.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ function color() {
printf "\033[%sm%s\033[0m\n" "$color_code" "$*"
}

function set_docker_buildx() {
set +e
out=$(docker buildx create --name chain-builder --use > /dev/null 2>&1)
if [[ $? -ne 0 ]]; then
docker buildx use chain-builder
fi
set -e
}

function image_tag_exists() {
local image=$1
local tag=$2
Expand Down Expand Up @@ -58,7 +67,7 @@ build_chain_tag() {
color yellow "building docker image $DOCKER_REPO/$chain:$tag for chain $chain"
for n in {1..3}; do
docker buildx build \
--platform linux/amd64 \
--platform linux/amd64,linux/arm64 \
-t "$DOCKER_REPO/$chain:$tag" \
. -f Dockerfile \
--build-arg BASE_IMAGE=$base \
Expand Down Expand Up @@ -130,6 +139,7 @@ while [ $# -gt 0 ]; do
esac
done

set_docker_buildx

if [[ $CHAIN == "all" ]]; then
build_all_chains $PUSH
Expand Down
1 change: 1 addition & 0 deletions docker/chains/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ chains:
- name: osmosis
base: ghcr.io/strangelove-ventures/heighliner/osmosis
tags:
- v15.1.2-wasmvm1.2.3
- v15.1.2
- v15.1.2-wasmvm1.1.2
- v15.1.0
Expand Down
2 changes: 1 addition & 1 deletion docker/explorers/ping-pub/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN cd /tmp && unzip ${VERSION##*/}.zip && mv /tmp/${CODE_NAME}-${VERSION##*/}/*
RUN echo "*.js\nsrc/\n" > .eslintignore

RUN rm -rf node_modules
RUN yarn install --frozen-lockfile
RUN yarn install --no-lockfile --network-timeout 100000

EXPOSE 8080
ENTRYPOINT ["yarn", "serve"]
1 change: 1 addition & 0 deletions docker/explorers/ping-pub/versions.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
base: node:16
versions:
- refs/heads/master
- 6b7b0d096946b6bcd75d15350c7345da0d4576db
- 6437369d84c374ee357370a219508948e605f7cc
4 changes: 2 additions & 2 deletions docker/faucet/cosmjs-faucet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ RUN rm -rf cosmjs.tar.gz
RUN apk add --update --no-cache alpine-sdk linux-headers build-base gcc libusb-dev python3 py3-pip eudev-dev nodejs yarn
RUN ln -sf python3 /usr/bin/python

RUN yarn cache clean --all && yarn install && yarn run build
RUN yarn cache clean --all && rm yarn.lock && yarn install --network-timeout 100000
RUN yarn run build
RUN (cd packages/faucet && SKIP_BUILD=1 yarn pack-node)

# Use Alpine and install Node.js which is 50% smaller than the -alpine version of the node
Expand All @@ -37,4 +38,3 @@ WORKDIR /app
EXPOSE 8000

ENTRYPOINT ["/app/packages/faucet/bin/cosmos-faucet-dist"]

3 changes: 1 addition & 2 deletions docker/faucet/cosmjs-faucet/versions.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
base: node:16-alpine
versions:
- v0.31.0-alpha.2
- v0.31.0-alpha.1
- v0.31.0
- v0.30.1
- v0.30.0
- v0.29.5
5 changes: 0 additions & 5 deletions docker/relayers/hermes/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,3 @@ base: informalsystems/hermes
versions:
- 1.5.1
- 1.5.0
- 1.4.1
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.0
2 changes: 1 addition & 1 deletion docs/pages/get-started/step-3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Run
```bash
helm repo add starship https://cosmology-tech.github.io/starship/
helm repo update
helm search repo starship/devnet --version 0.1.31
helm search repo starship/devnet --version 0.1.36
```

## 3.2) Define the desired infrastructure
Expand Down
2 changes: 1 addition & 1 deletion examples/cosmos-simapp-multi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FILE = configs/local.yaml

HELM_REPO = starship
HELM_CHART = devnet
HELM_VERSION = v0.1.35
HELM_VERSION = v0.1.36

###############################################################################
### All commands ###
Expand Down
2 changes: 1 addition & 1 deletion examples/getting-started/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TINY_FILE = configs/tiny-starship.yaml

HELM_REPO = starship
HELM_CHART = devnet
HELM_VERSION = v0.1.34
HELM_VERSION = v0.1.36

###############################################################################
### All commands ###
Expand Down
2 changes: 1 addition & 1 deletion examples/multi-chain/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FILE = config.yaml

HELM_REPO = starship
HELM_CHART = devnet
HELM_VERSION = v0.1.34
HELM_VERSION = v0.1.36

###############################################################################
### All commands ###
Expand Down
2 changes: 1 addition & 1 deletion examples/osmojs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ HELM_NAME = osmojs
HELM_FILE = configs/config.yaml
HELM_REPO = starship
HELM_CHART = devnet
HELM_VERSION = v0.1.34
HELM_VERSION = v0.1.36

###############################################################################
### All commands ###
Expand Down
14 changes: 13 additions & 1 deletion scripts/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ function color() {
printf "\033[%sm%s\033[0m\n" "$color_code" "$*"
}

function set_docker_buildx() {
set +e
out=$(docker buildx create --name chain-builder --use > /dev/null 2>&1)
if [[ $? -ne 0 ]]; then
docker buildx use chain-builder
fi
set -e
}

function is_directory {
if [ -d "$1" ]; then
return 0 # true
Expand Down Expand Up @@ -86,7 +95,8 @@ docker_process_build() {
if [[ "$push_image" != "push-only" ]]; then
color yellow "building docker image $DOCKER_REPO/$process:$tag from file $DOCKER_DIR/$type/$process/Dockerfile"
for n in {1..3}; do
docker buildx build --platform linux/amd64 \
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t "$DOCKER_REPO/$process:$tag" . \
--build-arg BASE_IMAGE=$base \
--build-arg VERSION=$version \
Expand Down Expand Up @@ -185,6 +195,8 @@ while [ $# -gt 0 ]; do
esac
done

set_docker_buildx

if [[ $TYPE == "all" ]]; then
build_all_types "all" "all" "all" $PUSH $PUSH_LATEST
exit 0
Expand Down

0 comments on commit 2400cee

Please sign in to comment.