diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 38a407a5..9bcaeb08 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,6 +7,9 @@ on: jobs: build-docker: + strategy: + matrix: + version: ["", "-alpine"] runs-on: ubuntu-latest steps: - name: Checkout source @@ -23,18 +26,20 @@ jobs: run: | # build only if not release tag, i.e. has some "-" in describe # so we do not duplicate work with release workflow. + dockerfile=Dockerfile${version/-/.} git describe --match 'v[0-9]*' | grep -q -e - && \ docker build \ - -t nipy/heudiconv:master \ - -t nipy/heudiconv:unstable \ - . + -t nipy/heudiconv:master${version} \ + -t nipy/heudiconv:unstable${version} \ + . \ + -f $dockerfile - name: Push Docker image run: | git describe --match 'v[0-9]*' | grep -q -e - && ( docker login -u "$DOCKER_LOGIN" --password-stdin <<<"$DOCKER_TOKEN" - docker push nipy/heudiconv:master - docker push nipy/heudiconv:unstable + docker push nipy/heudiconv:master${version} + docker push nipy/heudiconv:unstable${version} ) env: DOCKER_LOGIN: ${{ secrets.DOCKER_LOGIN }} diff --git a/Dockerfile.alpine b/Dockerfile.alpine new file mode 100644 index 00000000..428dbd91 --- /dev/null +++ b/Dockerfile.alpine @@ -0,0 +1,34 @@ +FROM python:3.10-alpine AS builder + +RUN apk add bash \ + gcc \ + g++ \ + libc-dev \ + make \ + cmake \ + util-linux-dev \ + curl \ + git +RUN pip install --no-cache-dir pylibjpeg-libjpeg traits==6.3.2 + +ARG DCM2NIIX_VERSION=v1.0.20240202 +RUN git clone https://github.com/rordenlab/dcm2niix /tmp/dcm2niix \ + && cd /tmp/dcm2niix \ + && git fetch --tags \ + && git checkout $DCM2NIIX_VERSION \ + && mkdir /tmp/dcm2niix/build \ + && cd /tmp/dcm2niix/build \ + && cmake -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr/ .. \ + && make -j1 \ + && make install \ + && rm -rf /tmp/dcm2niix + +FROM python:3.10-alpine +COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages +COPY --from=builder /usr/bin/dcm2niix /usr/bin/dcm2niix + +RUN apk update && apk add --no-cache git git-annex pigz gcompat + +RUN pip install --no-cache-dir heudiconv + +ENTRYPOINT ["heudiconv"]