diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e9d6341..f98fc04 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -59,18 +59,33 @@ jobs: id: meta run: | # For a release-triggered workflow, GITHUB_REF_NAME is the tag name (e.g., v0.2.3) + # but we strip the leading 'v' for the Docker tag (e.g., 0.2.3) echo "tag=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" - - name: Build and push + - name: Build and push base image uses: docker/build-push-action@v6 with: context: . file: ./docker/Dockerfile push: true + cache-from: type=gha + cache-to: type=gha,mode=max tags: | ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.tag }} ${{ env.DOCKER_IMAGE }}:latest + - name: Build and push image with data + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/add_data.dockerfile + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + tags: | + ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.tag }}-with-data + ${{ env.DOCKER_IMAGE }}:latest-with-data + publish-pypi: name: Publish sdist to PyPI runs-on: ubuntu-latest diff --git a/docker/add_data.dockerfile b/docker/add_data.dockerfile new file mode 100644 index 0000000..4e3797d --- /dev/null +++ b/docker/add_data.dockerfile @@ -0,0 +1,17 @@ +FROM antsx/antspynet:latest + +USER root +WORKDIR /home/antspyuser + +RUN . "${VIRTUAL_ENV}/bin/activate" && \ + /opt/bin/download_antsxnet_data.py \ + --cache-dir /home/antspyuser/.keras/ANTsXNet \ + --strict && \ + chmod -R 0755 /home/antspyuser/.antspy /home/antspyuser/.keras + +USER antspyuser + +LABEL maintainer="Philip A Cook (https://github.com/cookpa)" \ + description="ANTsPyNet is part of the ANTsX ecosystem (https://github.com/ANTsX). \ +ANTsX citation: https://pubmed.ncbi.nlm.nih.gov/33907199" +ENTRYPOINT ["python"]