Docker Build #5
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: Docker Build | |
on: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Enable tmate debugging' | |
required: false | |
default: false | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Free up space on runner for Docker | |
shell: bash | |
continue-on-error: true | |
run: | | |
df -h | |
sudo apt-get remove -y 'temurin-.*' | |
sudo apt-get remove -y google-cloud-cli | |
sudo apt-get remove -y microsoft-edge-stable | |
sudo apt-get remove -y azure-cli | |
sudo apt-get remove -y google-chrome-stable | |
sudo apt-get remove -y '^ghc-8.*' | |
sudo apt-get remove -y '^dotnet-.*' | |
sudo apt-get remove -y '^llvm-.*' | |
sudo apt-get remove -y 'php.*' | |
sudo apt-get remove -y '^swift.*' | |
sudo apt-get remove -y powershell | |
sudo rm -rf /usr/share/dotnet/ /usr/share/swift/ | |
df -h | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
tags: user/app:latest | |
cache-from: type=registry,ref=user/app:latest | |
cache-to: type=inline |