Merge branch 'master' of github.com:FNNDSC/microminc #24
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: 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: 8192 # 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@v4 | |
# QEMU is used for non-x86_64 builds | |
- uses: docker/setup-qemu-action@v3 | |
# buildx adds additional features to docker build | |
- uses: docker/setup-buildx-action@v3 | |
- name: Run 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 | |
- name: Test | |
run: | | |
docker run --rm \ | |
-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@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push images | |
uses: docker/build-push-action@v5 | |
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 | |
- 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 | |
repository: fnndsc/microminc-builder |