Local Node - Build docker image #62
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Local Node - Build docker image | |
on: | |
workflow_dispatch: | |
inputs: | |
image_tag: | |
description: "Tag of a built image to deploy (latest2.0 by default)" | |
type: string | |
required: false | |
default: "latest2.0" | |
compilers: | |
description: 'JSON of required compilers and their versions' | |
type: string | |
required: false | |
default: '[{ "zksolc": ["1.3.14", "1.3.16", "1.3.17", "1.3.1", "1.3.7", "1.3.18", "1.3.19", "1.3.21"] } , { "zkvyper": ["1.3.13"] }]' | |
jobs: | |
build-images: | |
name: Local Node - Build and Push Docker Image | |
runs-on: [ matterlabs-ci-runner-high-performance ] | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
submodules: "recursive" | |
- name: setup-env | |
run: | | |
echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV | |
echo CI=1 >> $GITHUB_ENV | |
echo $(pwd)/bin >> $GITHUB_PATH | |
echo CI=1 >> .env | |
echo IN_DOCKER=1 >> .env | |
# TODO: Remove after when we can upgrade hardhat-plugins | |
- name: pre-download compiilers | |
run: | | |
# Download needed versions of vyper compiler | |
# Not sanitized due to unconventional path and tags | |
mkdir -p ./hardhat-nodejs/compilers-v2/vyper/linux | |
wget -nv -O ./hardhat-nodejs/compilers-v2/vyper/linux/0.3.10 https://github.com/vyperlang/vyper/releases/download/v0.3.10/vyper.0.3.10+commit.91361694.linux | |
wget -nv -O ./hardhat-nodejs/compilers-v2/vyper/linux/0.3.3 https://github.com/vyperlang/vyper/releases/download/v0.3.3/vyper.0.3.3+commit.48e326f0.linux | |
chmod +x ./hardhat-nodejs/compilers-v2/vyper/linux/0.3.10 | |
chmod +x ./hardhat-nodejs/compilers-v2/vyper/linux/0.3.3 | |
COMPILERS_JSON='${{ inputs.compilers }}' | |
echo "$COMPILERS_JSON" | jq -r '.[] | to_entries[] | .key as $compiler | .value[] | "\(.),\($compiler)"' | while IFS=, read -r version compiler; do | |
mkdir -p "./hardhat-nodejs/compilers-v2/$compiler" | |
wget -nv -O "./hardhat-nodejs/compilers-v2/$compiler/${compiler}-v${version}" "https://github.com/matter-labs/${compiler}-bin/releases/download/v${version}/${compiler}-linux-amd64-musl-v${version}" | |
chmod +x "./hardhat-nodejs/compilers-v2/$compiler/${compiler}-v${version}" | |
done | |
- name: start-services | |
run: | | |
run_retried docker compose pull zk postgres | |
docker compose up -d zk postgres | |
- name: Install zkstack | |
run: | | |
ci_run ./zkstack_cli/zkstackup/install -g --path ./zkstack_cli/zkstackup/zkstackup || true | |
ci_run zkstackup -g | |
- name: init | |
run: | | |
ci_run git config --global --add safe.directory /usr/src/zksync | |
ci_run git config --global --add safe.directory /usr/src/zksync/contracts/system-contracts | |
ci_run git config --global --add safe.directory /usr/src/zksync/contracts | |
ci_run zk | |
ci_run cp etc/tokens/{test,localhost}.json | |
- name: build contracts | |
run: | | |
ci_run zkstack dev contracts | |
- name: update-image | |
run: | | |
ci_run docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
ci_run zk docker build server-v2 | |
ci_run gcloud auth configure-docker us-docker.pkg.dev -q | |
ci_run zk docker push local-node --custom-tag ${{ inputs.image_tag }} |