|
| 1 | +# Copyright (C) 2024 Roberto Rossini <roberros@uio.no> |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: MIT |
| 4 | + |
| 5 | +##### IMPORTANT ##### |
| 6 | +# This Dockerfile requires several build arguments to be defined through --build-arg |
| 7 | +# See utils/devel/build_dockerfile.sh for an example of how to build this Dockerfile |
| 8 | +##################### |
| 9 | + |
| 10 | +ARG BASE_IMAGE |
| 11 | +ARG BASE_IMAGE_DIGEST |
| 12 | +FROM "${BASE_IMAGE}@${BASE_IMAGE_DIGEST}" AS builder |
| 13 | + |
| 14 | +ARG GIT_HASH |
| 15 | +ARG CREATION_DATE |
| 16 | +ARG VERSION |
| 17 | + |
| 18 | +RUN if [ -z "$GIT_HASH" ]; then echo "Missing GIT_HASH --build-arg" && exit 1; fi \ |
| 19 | +&& if [ -z "$CREATION_DATE" ]; then echo "Missing CREATION_DATE --build-arg" && exit 1; fi \ |
| 20 | +&& if [ -z "$VERSION" ]; then echo "Missing VERSION --build-arg" && exit 1; fi |
| 21 | + |
| 22 | +ARG SETUPTOOLS_SCM_PRETEND_VERSION="$VERSION" |
| 23 | +ARG src_dir='/root/stripepy' |
| 24 | +ARG install_dir='/opt/stripepy' |
| 25 | + |
| 26 | +COPY . "$src_dir/" |
| 27 | + |
| 28 | +RUN python3 -m venv "$install_dir" \ |
| 29 | +&& "$install_dir/bin/pip" install "$src_dir" -v |
| 30 | + |
| 31 | + |
| 32 | +ARG BASE_IMAGE |
| 33 | +ARG BASE_IMAGE_DIGEST |
| 34 | +FROM "${BASE_IMAGE}@${BASE_IMAGE_DIGEST}" AS tester |
| 35 | + |
| 36 | +ARG VERSION |
| 37 | + |
| 38 | +ARG SETUPTOOLS_SCM_PRETEND_VERSION="$VERSION" |
| 39 | +ARG src_dir='/root/stripepy' |
| 40 | +ARG install_dir='/opt/stripepy' |
| 41 | + |
| 42 | +COPY --from=builder "$src_dir" "$src_dir" |
| 43 | +COPY --from=builder "$install_dir" "$install_dir" |
| 44 | + |
| 45 | +RUN "$install_dir/bin/pip" install "$src_dir[test]" -v |
| 46 | + |
| 47 | +RUN "$install_dir/bin/python3" -m pytest "$src_dir/test" |
| 48 | + |
| 49 | + |
| 50 | +ARG BASE_IMAGE |
| 51 | +ARG BASE_IMAGE_DIGEST |
| 52 | +FROM "${BASE_IMAGE}@${BASE_IMAGE_DIGEST}" AS base |
| 53 | + |
| 54 | +ARG BASE_IMAGE |
| 55 | +ARG BASE_IMAGE_DIGEST |
| 56 | +ARG GIT_HASH |
| 57 | +ARG CREATION_DATE |
| 58 | +ARG VERSION |
| 59 | + |
| 60 | +ARG src_dir='/root/stripepy' |
| 61 | +ARG install_dir='/opt/stripepy' |
| 62 | + |
| 63 | +COPY --from=builder "$install_dir" /opt/stripepy/ |
| 64 | +COPY --from=tester "$src_dir/LICENCE" /opt/stripepy/share/licenses/stripepy/LICENCE |
| 65 | + |
| 66 | +WORKDIR /data |
| 67 | +ENTRYPOINT ["/opt/stripepy/bin/stripepy"] |
| 68 | +ENV PATH="$PATH:/opt/stripepy/bin" |
| 69 | + |
| 70 | +RUN stripepy --help |
| 71 | +RUN stripepy --version |
| 72 | + |
| 73 | +# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys |
| 74 | +LABEL org.opencontainers.image.authors='Andrea Raffo <andrea.raffo@ibv.uio.no>,Roberto Rossini <roberros@uio.no>' |
| 75 | +LABEL org.opencontainers.image.url='https://github.com/paulsengroup/stripepy' |
| 76 | +LABEL org.opencontainers.image.documentation='https://github.com/paulsengroup/stripepy' |
| 77 | +LABEL org.opencontainers.image.source='https://github.com/paulsengroup/stripepy' |
| 78 | +LABEL org.opencontainers.image.licenses='MIT' |
| 79 | +LABEL org.opencontainers.image.title='StripePy' |
| 80 | +LABEL org.opencontainers.image.description='StripePy recognizes linear patterns in chromosome conformation capture contact maps using geometric reasoning' |
| 81 | +LABEL org.opencontainers.image.base.digest="$BASE_IMAGE_DIGEST" |
| 82 | +LABEL org.opencontainers.image.base.name="$BASE_IMAGE" |
| 83 | + |
| 84 | +LABEL org.opencontainers.image.revision="$GIT_HASH" |
| 85 | +LABEL org.opencontainers.image.created="$CREATION_DATE" |
| 86 | +LABEL org.opencontainers.image.version="$VERSION" |
0 commit comments