Further limit batch sizes to 50 #127
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: Build and Push | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+-*" | |
env: | |
# DOCKER_IMAGE: "" | |
DOCKER_REPO: matterlabs | |
jobs: | |
pre: | |
runs-on: ubuntu-latest | |
outputs: | |
image: ${{ steps.set.outputs.image }} | |
steps: | |
- uses: actions/github-script@v4 | |
id: set | |
with: | |
script: |- | |
const imageRepo = '${{ github.event.repository.owner.login }}'.toLowerCase().replace(/\/docker-/, '/') | |
const imageName = '${{ github.event.repository.name }}'.toLowerCase().replace(/\/docker-/, '/') | |
let imagePaths = [ | |
'${{ env.DOCKER_REPO }}' == '' ? imageRepo : '${{ env.DOCKER_REPO }}', | |
'${{ env.DOCKER_IMAGE }}' == '' ? imageName : '${{ env.DOCKER_IMAGE }}', | |
] | |
core.setOutput('image', imagePaths.join('/')) | |
build: | |
name: Build Docker Image | |
runs-on: ubuntu-latest | |
needs: [pre] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dysnix/find-latest-tag@v1 | |
id: latest | |
with: | |
regex: '^v\d' | |
compared-to-tag: ${{ github.ref }} | |
repository: ${{ github.repository }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ needs.pre.outputs.image }} | |
flavor: | | |
latest=${{ steps.latest.outputs.newer == 'true' || steps.latest.outputs.equal == 'true' }} | |
tags: | | |
type=ref,event=tag | |
type=ref,event=branch | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ github.event.before }} | |
- uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: docker/Dockerfile.zksync | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
push: ${{ startsWith(github.ref, 'refs/tags/') }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
- # Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |