15
15
# `numpy-gitpod` and `numpy-dev`—and I'm not going to use a `-dev` image in production.) See the `py_deps`
16
16
# below.
17
17
18
- FROM alpine:3.18
18
+ FROM alpine:3.19
19
19
20
20
21
21
# Configurable Arguments
58
58
:
59
59
60
60
RUN \
61
- build_deps="automake bzip2-dev cyrus-sasl-dev git g++ gcc libffi-dev libjpeg-turbo-dev libwebp-dev libxml2-dev libxslt-dev make musl-dev openjpeg-dev openldap-dev openssl-dev pcre-dev python3-dev postgresql-dev su-exec tiff-dev zlib-dev " &&\
62
- run_deps="curl krb5-libs libgcc libjpeg-turbo libldap libpq libsasl libstdc++ libwebp libxml2 libxslt netcat-openbsd openjpeg python3 rsync tiff tidyhtml" &&\
61
+ build_deps="automake bzip2-dev cyrus-sasl-dev git g++ gcc libffi-dev libjpeg-turbo-dev libwebp-dev libxml2-dev libxslt-dev make musl-dev openjpeg-dev openldap-dev openssl-dev pcre-dev python3-dev postgresql-dev su-exec tiff-dev zlib-dev py3-pip " &&\
62
+ run_deps="curl krb5-libs libgcc libjpeg-turbo libldap libpq libsasl libstdc++ libwebp libxml2 libxslt netcat-openbsd openjpeg python3 rsync tiff tidyhtml py3-gunicorn py3-flask " &&\
63
63
py_deps="py3-numpy py3-pandas py3-pillow py3-psycopg2 py3-biopython" &&\
64
64
/sbin/apk update --quiet &&\
65
65
/sbin/apk add --no-progress --quiet --virtual /edrn-build $build_deps &&\
@@ -69,20 +69,19 @@ RUN \
69
69
70
70
# Over on GitHub Actions, we need to fail fast and not hit the six hour run limit, so make sure we got it right
71
71
72
- RUN [ "`/usr/bin/python3 --version`" = "Python 3.11.10" ]
73
- RUN [ "`/usr/bin/python3 -c 'import numpy; print(numpy.__version__)'`" = "1.24.4" ]
74
- RUN [ "`/usr/bin/python3 -c 'import pandas; print(pandas.__version__)'`" = "1.5.3" ]
75
- RUN [ "`/usr/bin/python3 -c 'import PIL; print(PIL.__version__)'`" = "9.5.0" ]
76
- RUN [ "`/usr/bin/python3 -c 'import psycopg2; print(psycopg2.__version__)'`" = "2.9.6 (dt dec pq3 ext lo64)" ]
77
- RUN [ "`/usr/bin/python3 -c 'import Bio; print(Bio.__version__)'`" = "1.81" ]
72
+ RUN echo `/usr/bin/python3 --version` | grep -q '^Python 3\. 11\. '
73
+ RUN echo `/usr/bin/python3 -c 'import numpy; print(numpy.__version__)' ` | grep -q '^1\. 25\. '
74
+ RUN echo `/usr/bin/python3 -c 'import pandas; print(pandas.__version__)' ` | grep -q '^2\. 0\. '
75
+ RUN echo `/usr/bin/python3 -c 'import PIL; print(PIL.__version__)' ` | grep -q '^10\. 3\. '
76
+ RUN echo `/usr/bin/python3 -c 'import psycopg2; print(psycopg2.__version__)' ` | grep -q '^2\. 9\. '
77
+ # Note that Biopython does not use MAJOR.MINOR.MICRO versions so there's no trailing dot here
78
+ RUN echo `/usr/bin/python3 -c 'import Bio; print(Bio.__version__)' ` | grep -q '^1\. 81'
78
79
79
80
RUN \
80
81
: See https://github.com/python-ldap/python-ldap/issues/432 for workaround to Python LDAP vs OpenLDAP 2.5 issue &&\
81
82
echo 'INPUT ( libldap.so )' > /usr/lib/libldap_r.so &&\
82
- /usr/bin/python3 -m ensurepip --upgrade &&\
83
- /usr/bin/pip3 install --quiet --progress-bar off --upgrade pip setuptools wheel &&\
84
- /usr/bin/pip3 install gunicorn==20.1.0 &&\
85
- /usr/bin/install -o edrn -g edrn -d /app /app/media /app/static /app/wheels &&\
83
+ /usr/bin/python3 -m venv --system-site-packages --upgrade-deps /app &&\
84
+ /usr/bin/install -o edrn -g edrn -d /app/media /app/static /app/wheels &&\
86
85
:
87
86
88
87
COPY --chown=edrn:edrn ./dist/*.whl /app/wheels/
@@ -104,32 +103,30 @@ COPY --chown=edrn:edrn ./dist/*.whl /app/wheels/
104
103
# Except the Docker plugin for Jenkins at CBIIT chokes with an HTTP 400 error because apparently
105
104
# the single layer made above is too big. So, we have to do these in separate RUNs:
106
105
107
- RUN /usr /bin/pip3 install --progress-bar off /app/wheels/edrnsite.controls-*.whl
108
- RUN /usr /bin/pip3 install --progress-bar off /app/wheels/edrnsite.streams-*.whl
109
- RUN /usr /bin/pip3 install --progress-bar off /app/wheels/edrnsite.content-*.whl
110
- RUN /usr /bin/pip3 install --progress-bar off /app/wheels/edrn.collabgroups-*.whl
111
- RUN /usr /bin/pip3 install --progress-bar off /app/wheels/edrn.theme-*.whl
112
- RUN /usr /bin/pip3 install --progress-bar off /app/wheels/edrnsite.ploneimport-*.whl
113
- RUN /usr /bin/pip3 install --progress-bar off /app/wheels/eke.geocoding-*.whl
114
- RUN /usr /bin/pip3 install --progress-bar off /app/wheels/eke.knowledge-*.whl
115
- RUN /usr /bin/pip3 install --progress-bar off /app/wheels/eke.biomarkers-*.whl
116
- RUN /usr /bin/pip3 install --progress-bar off /app/wheels/edrnsite.search-*.whl
117
- RUN /usr /bin/pip3 install --progress-bar off /app/wheels/edrn.metrics-*.whl
118
- RUN /usr /bin/pip3 install --progress-bar off /app/wheels/edrnsite.policy-*.whl
106
+ RUN /app /bin/pip3 install --progress-bar off /app/wheels/edrnsite.controls-*.whl
107
+ RUN /app /bin/pip3 install --progress-bar off /app/wheels/edrnsite.streams-*.whl
108
+ RUN /app /bin/pip3 install --progress-bar off /app/wheels/edrnsite.content-*.whl
109
+ RUN /app /bin/pip3 install --progress-bar off /app/wheels/edrn.collabgroups-*.whl
110
+ RUN /app /bin/pip3 install --progress-bar off /app/wheels/edrn.theme-*.whl
111
+ RUN /app /bin/pip3 install --progress-bar off /app/wheels/edrnsite.ploneimport-*.whl
112
+ RUN /app /bin/pip3 install --progress-bar off /app/wheels/eke.geocoding-*.whl
113
+ RUN /app /bin/pip3 install --progress-bar off /app/wheels/eke.knowledge-*.whl
114
+ RUN /app /bin/pip3 install --progress-bar off /app/wheels/eke.biomarkers-*.whl
115
+ RUN /app /bin/pip3 install --progress-bar off /app/wheels/edrnsite.search-*.whl
116
+ RUN /app /bin/pip3 install --progress-bar off /app/wheels/edrn.metrics-*.whl
117
+ RUN /app /bin/pip3 install --progress-bar off /app/wheels/edrnsite.policy-*.whl
119
118
120
119
# And this too:
121
120
122
121
RUN \
123
122
cd /app &&\
124
123
: Get the static files ready &&\
125
- /sbin/su-exec edrn /usr/bin/env LDAP_BIND_PASSWORD=unused SIGNING_KEY=unused /usr /bin/django-admin collectstatic --settings edrnsite.policy.settings.ops --no-input --clear --link &&\
124
+ /sbin/su-exec edrn /usr/bin/env LDAP_BIND_PASSWORD=unused SIGNING_KEY=unused /app /bin/django-admin collectstatic --settings edrnsite.policy.settings.ops --no-input --clear --link &&\
126
125
: Clean up clean up everybody everywhere &&\
127
- : PrismaCloud does not like pip to be in the image &&\
128
- /usr/bin/pip3 uninstall --yes --quiet pip &&\
129
126
/sbin/apk del --quiet /edrn-build &&\
130
127
/bin/rm -rf /app/wheels &&\
131
128
/bin/rm -rf /var/cache/apk/* &&\
132
- /bin/chown -R edrn:edrn /usr /lib/python3.*/site-packages &&\
129
+ /bin/chown -R edrn:edrn /app /lib/python3.*/site-packages &&\
133
130
:
134
131
135
132
COPY --chown=edrn:edrn docker/*.py /app/
@@ -144,7 +141,8 @@ EXPOSE 8000
144
141
VOLUME ["/app/media" ]
145
142
USER edrn
146
143
WORKDIR /app
147
- ENTRYPOINT ["/usr/bin/gunicorn" ]
144
+ ENTRYPOINT ["/app/bin/python3" ]
145
+ CMD ["/usr/bin/gunicorn" , "-c" , "/app/gunicorn.conf.py" ]
148
146
HEALTHCHECK --interval=5m --timeout=2m --start-period=10m CMD /usr/bin/curl --fail --retry 6 --max-time 5 --retry-delay 10 --retry-max-time 60 http://127.0.0.1:8000/ || /bin/sh -c 'killall5 -TERM && (/bin/sleep 10; killall5 -KILL)'
149
147
150
148
0 commit comments