Skip to content

Publish UTBot base environment image #98

Publish UTBot base environment image

Publish UTBot base environment image #98

name: Publish UTBot base environment image
on:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: base_env
jobs:
matrix-prep:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- id: set-matrix
name: Read config from matrix.json
run: |
TASKS=$(echo $(cat .github/workflows/matrix.json) | sed 's/ //g' )
echo "matrix=$TASKS" >> $GITHUB_OUTPUT
build-docker:
needs: matrix-prep
strategy:
matrix: ${{ fromJson(needs.matrix-prep.outputs.matrix) }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{env.IMAGE_NAME}}-${{ matrix.DOCKER_TAG }}
restore-keys: |
${{ runner.os }}-buildx-buildx
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{env.REGISTRY}}/${{github.repository}}/${{env.IMAGE_NAME}}
tags: |
type=raw,value=${{ matrix.DOCKER_TAG }}
- name: Build and push image
uses: docker/build-push-action@v3
with:
context: docker
push: true
builder: ${{ steps.buildx.outputs.name }}
file: docker/Dockerfile_base
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
build-args: |
OPERATING_SYSTEM_TAG=${{ matrix.OPERATING_SYSTEM_TAG }}
LLVM_VERSION_MAJOR=${{ matrix.LLVM_VERSION_MAJOR }}
# 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