12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
- FROM ubuntu:16.04
15
+ FROM ubuntu:16.04 as base-stage
16
16
17
17
# Install required packages and remove the apt packages cache when done.
18
18
@@ -24,8 +24,6 @@ RUN apt-get update && \
24
24
python3-dev \
25
25
python3-setuptools \
26
26
python3-pip \
27
- nginx \
28
- supervisor \
29
27
cron \
30
28
tzdata \
31
29
sqlite3 && \
@@ -36,22 +34,32 @@ RUN apt-get update && \
36
34
ENV TZ=Europe/Amsterdam
37
35
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
38
36
39
- # install uwsgi now because it takes a little while
40
- RUN pip3 install uwsgi
37
+ # COPY requirements.txt and RUN pip install BEFORE adding the rest of your code, this will cause Docker's caching mechanism
38
+ # to prevent re-installing (all your) dependencies when you made a change a line or two in your app.
39
+
40
+ COPY requirements /home/docker/code/
41
41
42
+
43
+
44
+ From base-stage as develop-stage
45
+ RUN pip3 install -r /home/docker/code/local.txt
46
+
47
+ # add (the rest of) our code
48
+ COPY . /home/docker/code/
49
+
50
+
51
+
52
+ FROM base-stage as production-stage
42
53
# setup all the configfiles
43
54
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
44
55
COPY deploy/nginx-app.conf /etc/nginx/sites-available/default
45
56
COPY deploy/supervisor-app.conf /etc/supervisor/conf.d/
46
57
47
- # COPY requirements.txt and RUN pip install BEFORE adding the rest of your code, this will cause Docker's caching mechanism
48
- # to prevent re-installing (all your) dependencies when you made a change a line or two in your app.
49
58
50
- COPY requirements /home/docker/code/
51
59
RUN pip3 install -r /home/docker/code/production.txt
52
60
53
61
# add (the rest of) our code
54
62
COPY . /home/docker/code/
55
63
56
64
EXPOSE 8888
57
- CMD ["supervisord" , "-n" ]
65
+ CMD ["supervisord" , "-n" ]
0 commit comments