Merge pull request #184 from pni-lab/slurmify-pumi #135
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: Test and Dockerize | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out PUMI | |
uses: actions/checkout@v3 | |
- name: Patch Docker Daemon data-root to take use of free-space | |
run: | | |
DOCKER_DATA_ROOT='/home/runner/work/docker' | |
DOCKER_DAEMON_JSON='/etc/docker/daemon.json' | |
sudo mkdir -p "${DOCKER_DATA_ROOT}" | |
jq --arg dataroot "${DOCKER_DATA_ROOT}" '. + {"data-root": $dataroot}' "${DOCKER_DAEMON_JSON}" > "/tmp/docker.json.tmp" | |
sudo mv "/tmp/docker.json.tmp" "${DOCKER_DAEMON_JSON}" | |
sudo systemctl restart docker | |
- name: Check free space | |
run: | | |
echo "Free space:" | |
df -h | |
- name: Set up neurodocker | |
run: | | |
pip install --user neurodocker[minify] | |
wget -P /home/runner/.local/lib/python3.8/site-packages/neurodocker/cli/minify/ https://raw.githubusercontent.com/ReproNim/neurodocker/master/neurodocker/cli/minify/_trace.sh | |
- name: Get tag | |
id: tag | |
uses: oprypin/find-latest-tag@v1 | |
with: | |
repository: pni-lab/PUMI # The repository to scan. | |
- name: Minify the Docker image | |
run: ./deploy_slim.sh ${{steps.tag.outputs.tag}} | |
- name: Check free space | |
run: | | |
echo "Free space:" | |
df -h | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker Push | |
run: | | |
VER=`echo ${{steps.tag.outputs.tag}} | awk -F'[.-]' '{print $1 "." $2 "." $3}'` #major.minor.patch | |
docker push pnilab/pumi-slim:latest | |
docker push pnilab/pumi-slim:$VER | |