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