-
Notifications
You must be signed in to change notification settings - Fork 21
/
Dockerfile
75 lines (70 loc) · 2.76 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
FROM ubuntu:16.04
LABEL maintainer "[email protected]"
ENV PYTHONUNBUFFERED 1
# Installs the base system dependencies for running the site.
# None of this will change with the codebase itself, so this
# whole layer and steps to build it should be cached.
RUN apt-get -y update && apt-get install -y \
supervisor \
libmysqlclient-dev \
mysql-client \
python-dev \
libjpeg-dev \
libcurl4-openssl-dev \
curl \
wget \
vim \
htop \
libpcre3 \
libpcre3-dev \
libssl-dev \
libffi-dev \
python-pip && \
rm -rf /var/lib/apt/lists/* && \
\
pip install -U 'pip==20.3.4' 'setuptools==44.0.0' distribute && \
# fixes a weird issue where distribute complains about setuptools "0.7"
# (incorrectly matching version "20.7.0" which ubuntu 16.04 has preinstalled)
rm -rf /usr/lib/python2.7/dist-packages/setuptools-20.7.0.egg-info && \
\
# install nginx + upload module
mkdir -p /tmp/install && \
cd /tmp/install && \
wget http://nginx.org/download/nginx-0.8.55.tar.gz && tar zxf nginx-0.8.55.tar.gz && \
wget https://github.com/fdintino/nginx-upload-module/archive/2.2.0.tar.gz && tar zxf 2.2.0.tar.gz && \
cd /tmp/install/nginx-0.8.55 && \
./configure \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-pcre \
--sbin-path=/usr/sbin/nginx \
--pid-path=/run/nginx.pid \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/srv/mltshp.com/nginx-error.log \
--http-log-path=/srv/mltshp.com/nginx-access.log \
--add-module=/tmp/install/nginx-upload-module-2.2.0 && \
make && make install && \
mkdir -p /etc/nginx && \
rm -rf /tmp/install && \
groupadd ubuntu --gid=1010 && \
useradd ubuntu --create-home --home-dir=/home/ubuntu \
--uid=1010 --gid=1010 && \
mkdir -p /mnt/tmpuploads/0 /mnt/tmpuploads/1 /mnt/tmpuploads/2 \
/mnt/tmpuploads/3 /mnt/tmpuploads/4 /mnt/tmpuploads/5 \
/mnt/tmpuploads/6 /mnt/tmpuploads/7 /mnt/tmpuploads/8 \
/mnt/tmpuploads/9 && \
chmod 777 /mnt/tmpuploads/* && \
mkdir -p /srv/mltshp.com/uploaded /srv/mltshp.com/logs && \
chown -R ubuntu:ubuntu /srv/mltshp.com
# Install python dependencies which will be cached on the
# contents of requirements.txt:
COPY requirements.txt /tmp
RUN pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt
# Copy configuration settings into place
COPY setup/production/supervisord-web.conf /etc/supervisor/conf.d/mltshp.conf
COPY setup/production/nginx.conf /etc/nginx/nginx.conf
# Add "." for the app code itself (also allows for local dev)
ADD . /srv/mltshp.com/mltshp
WORKDIR /srv/mltshp.com/mltshp
EXPOSE 80
CMD ["/usr/bin/supervisord"]