forked from uc-cdis/peregrine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestDockerfile
67 lines (56 loc) · 2.34 KB
/
TestDockerfile
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
# To run: docker run -v /path/to/wsgi.py:/var/www/peregrine/wsgi.py --name=peregrine -p 81:80 peregrine
# To check running container: docker exec -it peregrine /bin/bash
FROM ubuntu:16.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
# dependency for cryptography
libffi-dev \
# dependency for pyscopg2 - which is dependency for sqlalchemy postgres engine
libpq-dev \
# dependency for cryptography
libssl-dev \
libxml2-dev \
libxslt1-dev \
nginx \
python3-dev \
python3-pip \
python3-setuptools \
sudo \
vim \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& python -m pip install --upgrade pip \
&& python -m pip install --upgrade setuptools \
&& python -m pip install --upgrade uwsgi \
&& mkdir /var/www/peregrine \
&& mkdir -p /var/www/.cache/Python-Eggs/ \
&& chown www-data -R /var/www/.cache/Python-Eggs/ \
&& mkdir /run/nginx/
COPY requirements.txt /peregrine/requirements.txt
COPY dev-requirements.txt /peregrine/dev-requirements.txt
WORKDIR /peregrine
RUN pip install -r requirements.txt \
&& pip install -r dev-requirements.txt
RUN apt-get install -y --no-install-recommends postgresql
COPY . /peregrine
COPY ./deployment/uwsgi/uwsgi.ini /etc/uwsgi/uwsgi.ini
COPY ./deployment/nginx/nginx.conf /etc/nginx/
COPY ./deployment/nginx/uwsgi.conf /etc/nginx/sites-available/
RUN COMMIT=`git rev-parse HEAD` && echo "COMMIT=\"${COMMIT}\"" >peregrine/version_data.py \
&& VERSION=`git describe --always --tags` && echo "VERSION=\"${VERSION}\"" >>peregrine/version_data.py \
&& cd /peregrine/src/gdcdictionary && DICTCOMMIT=`git rev-parse HEAD` && echo "DICTCOMMIT=\"${DICTCOMMIT}\"" >>/peregrine/peregrine/version_data.py \
&& DICTVERSION=`git describe --always --tags` && echo "DICTVERSION=\"${DICTVERSION}\"" >>/peregrine/peregrine/version_data.py \
&& python setup.py install \
&& rm /etc/nginx/sites-enabled/default \
&& ln -s /etc/nginx/sites-available/uwsgi.conf /etc/nginx/sites-enabled/uwsgi.conf \
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
&& chown www-data /var/www/peregrine
RUN chmod -R 777 .
USER postgres
RUN ./run_tests.sh
EXPOSE 80
WORKDIR /var/www/peregrine
CMD /peregrine/dockerrun.bash