1
- # TODO: this is still not finished!!
2
1
FROM python:3.6-alpine as base
3
2
4
3
LABEL maintainer=mguidon
@@ -20,8 +19,12 @@ ENV HOME /home/scu
20
19
ENV VENV /home/scu/.venv/
21
20
ENV VENV3 $VENV
22
21
ENV VENV2 /home/scu/.venv27/
23
- ENV PIP /home/scu/.venv/bin/pip3
24
- ENV PIP2 $VENV2/bin/pip
22
+
23
+ # TODO: tmp workaround for https://github.com/pypa/pip/issues/6197
24
+ # - Added explicit --cache-dir that is removed at the end of the build
25
+ ENV PIP /home/scu/.venv/bin/pip3 --cache-dir=/pipcache
26
+ ENV PIP2 $VENV2/bin/pip --cache-dir=/pipcache2
27
+ # -----
25
28
26
29
EXPOSE 8080
27
30
@@ -48,16 +51,18 @@ RUN apk add --no-cache \
48
51
libc-dev \
49
52
libffi-dev \
50
53
python2 \
51
- python2-dev
54
+ python2-dev \
55
+ linux-headers
52
56
53
57
RUN python3 -m venv $HOME/.venv &&\
54
- $PIP install --no-cache-dir -- upgrade \
58
+ $PIP install --upgrade \
55
59
pip \
56
60
wheel \
57
- setuptools
61
+ setuptools &&\
62
+ $PIP list
58
63
59
64
RUN $PIP install virtualenv &&\
60
- $VENV3/bin/virtualenv --python=python2 $VENV2
65
+ $VENV3/bin/virtualenv --python=python2 $VENV2
61
66
62
67
WORKDIR /home/scu
63
68
@@ -66,35 +71,34 @@ WORKDIR /home/scu
66
71
COPY --chown=scu:scu services/storage/requirements/py27.txt requirements-py27.txt
67
72
COPY --chown=scu:scu services/storage/requirements/base.txt requirements-base.txt
68
73
COPY --chown=scu:scu services/storage/docker docker
69
- RUN $PIP install --no-cache-dir -r requirements-base.txt
70
74
71
- RUN apk add --no-cache \
72
- linux-headers
73
- RUN $PIP2 install --no-cache-dir -r requirements-py27.txt
75
+ RUN $PIP install -r requirements-base.txt
76
+ RUN $PIP2 install numpy==1.16.0 &&\
77
+ $PIP2 install -r requirements-py27.txt
78
+
74
79
# --------------------------Development stage -------------------
75
80
FROM build as development
76
81
77
82
ARG HOST_GID_ARG=1000
78
83
79
84
# install test 3rd party packages to accelerate runtime installs
80
85
COPY --chown=scu:scu services/storage/tests/requirements.txt requirements-tests.txt
81
- RUN $PIP install --no-cache-dir - r requirements-tests.txt
86
+ RUN $PIP install -r requirements-tests.txt
82
87
83
88
# in dev mode we give access to `scu` to host's mapped volumes
84
89
RUN addgroup -g $HOST_GID_ARG hgrp &&\
85
- addgroup scu hgrp && \
90
+ addgroup scu hgrp &&\
86
91
chown -R scu:scu $HOME/.venv
87
92
88
93
VOLUME /home/scu/packages
89
- VOLUME /home/scu/services/storage/
94
+ VOLUME /home/scu/services/storage
90
95
91
96
ENV DEBUG 1
92
97
ENTRYPOINT [ "/bin/sh" , "docker/entrypoint.sh" ]
93
98
CMD ["/bin/sh" , "docker/boot.sh" ]
94
99
95
100
96
101
# --------------------------Production multi-stage -------------------
97
- # FROM build as build-production
98
102
FROM build as cache
99
103
100
104
ENV SIMCORE_WEB_CONFIG production
@@ -105,28 +109,22 @@ COPY --chown=scu:scu packages $HOME/packages
105
109
COPY --chown=scu:scu services/storage $HOME/services/storage
106
110
107
111
WORKDIR /home/scu/services/storage
108
- RUN $PIP --no-cache-dir install -r requirements/prod.txt &&\
112
+ RUN $PIP install -r requirements/prod.txt &&\
109
113
$PIP list
110
114
111
- # -------------------
112
- # FROM base as production
113
- # TODO: PC some basic package missing
114
-
115
- # COPY --from=build-production --chown=scu:scu $HOME/services/server/boot.sh $HOME
116
- # COPY --from=build-production --chown=scu:scu $HOME/.venv $HOME/.venv
117
- # RUN . $HOME/.venv/bin/activate; pip list
118
115
119
- # FIXME: temporary solution until found missing packages
120
116
WORKDIR /home/scu
121
-
122
117
ENV DEBUG 0
123
118
124
119
FROM cache as production
120
+
125
121
# remove any unnecessary stuff
126
122
RUN . $HOME/.venv/bin/activate; pip list &&\
127
123
rm -rf $HOME/packages &&\
128
- rm -rf $HOME/services/storage
124
+ rm -rf $HOME/services/storage &&\
125
+ rm -rf /pipcache &&\
126
+ rm -rf /pipcache2
127
+
129
128
130
129
ENTRYPOINT [ "/bin/sh" , "docker/entrypoint.sh" ]
131
130
CMD ["/bin/sh" , "docker/boot.sh" ]
132
-
0 commit comments