Skip to content

Maximize build space #20

Maximize build space

Maximize build space #20

Workflow file for this run

name: build
on:
push:
branches: [ master ]
jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Stop docker
run: sudo systemctl stop docker
- name: Clean docker data
run: |
sudo rm -rf /var/lib/docker
sudo mkdir /var/lib/docker
- name: Maximize build space
uses: easimon/maximize-build-space@6ae56c86ea8db291ae39f62352a412c36ab8179b
with:
root-reserve-mb: 4096 # space needed for logs
swap-size-mb: 1 # must be >0
build-mount-path: /var/lib/docker
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'false'
- name: Start docker
run: sudo systemctl start docker
- uses: actions/checkout@v3
# QEMU is used for non-x86_64 builds
- uses: docker/setup-qemu-action@v2
# buildx adds additional features to docker build
- uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
# cache slightly improves rebuild time
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Local registry
run: docker run --rm -d -p 5000:5000 registry:2
- name: Build
uses: docker/build-push-action@v3
id: docker_build
with:
context: .
file: ./Dockerfile
tags: |
localhost:5000/fnndsc/microminc-builder:latest
platforms: linux/amd64,linux/arm64,linux/ppc64le
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Test
run: |
docker run --rm -it \
-v "$PWD/test.sh:/test.sh:ro" \
localhost:5000/fnndsc/microminc-builder:latest /test.sh
- name: Login to DockerHub
id: dockerhub_login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images
uses: docker/build-push-action@v3
id: docker_push
with:
context: .
file: ./Dockerfile
tags: |
docker.io/fnndsc/microminc-builder:latest
docker.io/fnndsc/microminc-builder:2.1.1
ghcr.io/fnndsc/microminc-builder:latest
ghcr.io/fnndsc/microminc-builder:2.1.1
platforms: linux/amd64,linux/arm64,linux/ppc64le
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Update DockerHub description
uses: peter-evans/dockerhub-description@v3
continue-on-error: true # it is not crucial that this works
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
short-description: Minimize images of CIVET + MINC tools
readme-filepath: ./README.md