# https://github.com/actions/starter-workflows/ci/docker-publish.yml # If using base images, don't forget to add READ access, eg. from a package settings page like: # https://github.com/orgs/storytold/packages/container/docker-base-images-rust-ssl/settings/actions_access name: "Speedup Test" on: push: branches: - speedup-experiments env: IMAGE_NAME: storyteller-rust-speedup-exp jobs: # Push image to GitHub Packages. # See also https://docs.docker.com/docker-hub/builds/ # See also https://depot.dev/blog/docker-layer-caching-in-github-actions # See also https://evilmartians.com/chronicles/build-images-on-github-actions-with-docker-layer-caching build-docker-image: name: "Build Docker Image" #runs-on: ubuntu-22.04 # runs-on: ubuntu-latest #runs-on: github-ubuntu-16core # NB: Premium GitHub runner with more cores runs-on: github-ubuntu-64core # NB: Premium GitHub runner with more cores if: github.event_name == 'push' permissions: packages: write contents: read steps: - uses: actions/checkout@v3 # - uses: docker/setup-buildx-action@v1 # name: Set up Docker Buildx - uses: docker/login-action@v1 name: Login to GitHub Container Registry with: registry: ghcr.io username: ${{ github.actor }} # username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Calculate short SHA id: vars # echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT run: | echo "sha_short=$(echo ${{ github.sha }} | cut -c1-12)" >> $GITHUB_OUTPUT - name: Emit short SHA run: | echo "Full SHA: ${{ github.sha }}" echo "Short SHA: ${{ steps.vars.outputs.sha_short }}" #- uses: actions/cache@v2 # name: Cache Docker layers # with: # path: /tmp/.buildx-cache # key: ${{ runner.os }}-buildx-${{ github.sha }} # restore-keys: | # ${{ runner.os }}-buildx- # Docs for this action are at https://github.com/marketplace/actions/build-docker-images-using-cache - uses: whoan/docker-build-with-cache-action@v6 with: registry: ghcr.io username: ${{ github.actor }} # username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} image_name: storytold/storyteller-rust-speedup-exp dockerfile: ./build/service_cpu.Dockerfile # NB: The `git_push_tag: true` option does not work as expected, so we put the sha in `image_tag`: # https://github.com/whoan/docker-build-with-cache-action/issues/72 image_tag: speedup-${{ steps.vars.outputs.sha_short }} # NB: Inject the Git SHA into the container so the servers can emit their own version: build_extra_args: "--build-arg=GIT_SHA=${{ github.sha }}" - name: Cleanup / Debug # This job will run even on failures to help with debugging. if: always() run: | echo "Report at final github action step:" echo "Disk usage:" pwd du -hsc * | sort -hr