-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
56 lines (45 loc) · 1.53 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
FROM python:3.7.1-slim-stretch
LABEL maintainer="doug.thor@gmail.com"
ENV WSGI_VERSION="4.6.5"
# Install Requirements
RUN apt-get update \
&& apt-get install -y \
apache2 \
apache2-dev \
make \
wget \
# Install mod_wsgi from source for our specific python version
&& wget \
-O mod_wsgi-$WSGI_VERSION.tar.gz \
"https://github.com/GrahamDumpleton/mod_wsgi/archive/$WSGI_VERSION.tar.gz" \
&& tar -xzf mod_wsgi-$WSGI_VERSION.tar.gz \
&& cd mod_wsgi-$WSGI_VERSION \
&& ./configure \
&& make \
&& make install \
&& cd / \
# Cleanup
&& rm -rf mod_wsgi-$WSGI_VERSION* \
&& apt-get remove -y apache2-dev wget make \
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
EXPOSE 80
# Run apache in the foreground
CMD ["apache2ctl", "-D", "FOREGROUND", "-e", "INFO"]
### Now that the base stuff is done with, actually install the app.
COPY requirements.txt /requirements.txt
RUN pip install \
-r /requirements.txt \
&& rm /requirements.txt
# I hate that I copy over everything.
COPY . /trendlines
COPY apache/trendlines.conf /etc/apache2/sites-available/trendlines.conf
COPY apache/wsgi.py /var/www/wsgi.py
COPY docker/trendlines.cfg /data/trendlines.cfg
# TODO: Replace with install from pypi? Not if I want things built off master.
RUN pip install -e /trendlines
RUN a2ensite trendlines \
&& a2dissite 000-default.conf \
&& chown -R www-data:www-data /data
# vim: tabstop=4 shiftwidth=4 expandtab filetype=dockerfile