Skip to content

Fix Docker deployment #146

Fix Docker deployment

Fix Docker deployment #146

Workflow file for this run

name: Build and Push Docker Image
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
env:
IMAGE_NAMESPACE: fabnemepfl
REGISTRY: docker.io
jobs:
build-docker:
strategy:
fail-fast: true
matrix:
include:
- platform: ubuntu-latest
path: docker/Dockerfile
tag_base: amd64
name: mmirage-git
- platform: ubuntu-latest
path: docker/Dockerfile.cpu
tag_base: amd64
name: mmirage-git-cpu
- platform: ubuntu-24.04-arm
path: docker/Dockerfile.cpu
tag_base: arm64
name: mmirage-git-cpu
runs-on: ${{ matrix.platform }}
environment: ${{ github.event_name != 'pull_request' && 'docker' || 'docker-ci' }}
steps:
- name: Free space (ARM)
if: matrix.platform == 'ubuntu-24.04-arm'
run: |
df -h
du -h -d1 /home/runner || true
rm -rf /opt/hostedtoolcache
rm -rf /home/runner/.cache
rm -rf /home/runner/.docker
rm -rf /home/runner/actions-runner/_work/_tool
df -h
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
docker-images: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true
- name: Check free space
run: df -h
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.path }}
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.name }}:latest-${{ matrix.tag_base }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.name }}:${{ github.sha }}-${{ matrix.tag_base }}