forked from catmaid/CATMAID
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (56 loc) · 2.54 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
FROM ubuntu:16.04
LABEL maintainer="Andrew Champion <[email protected]>, Tom Kazimiers <[email protected]>"
# For building the image, let dpkg/apt know that we install and configure
# non-interactively.
ARG DEBIAN_FRONTEND=noninteractive
# Install dependencies. Even though this image doesn't run its own Postgres
# instance, make sure we install the upstream version to match the manual (and
# make building images on top of this one easier).
RUN apt-get update -y \
&& apt-get install -y apt-utils gawk \
&& apt-get install -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& add-apt-repository -y ppa:nginx/stable \
&& add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" \
&& apt-get install -y wget ca-certificates \
&& wget --quiet -O - https://postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& apt-get update -y \
&& apt-get install -y python3.6 python3.6-dev git python-pip \
&& apt-get install -y nginx supervisor \
&& rm -rf /var/lib/apt/lists/*
ADD packagelist-ubuntu-16.04-apt.txt /home/
RUN apt-get update -y \
&& xargs apt-get install -y < /home/packagelist-ubuntu-16.04-apt.txt \
&& rm -rf /var/lib/apt/lists/*
ADD django/requirements.txt /home/django/
ENV WORKON_HOME /opt/virtualenvs
RUN mkdir -p /opt/virtualenvs \
&& /bin/bash -c "source /usr/share/virtualenvwrapper/virtualenvwrapper.sh \
&& mkvirtualenv catmaid -p /usr/bin/python3.6 \
&& workon catmaid \
&& pip install -U pip setuptools \
&& pip install -r /home/django/requirements.txt"
ADD . /home/
# uWSGI setup
RUN /bin/bash -c "source /usr/share/virtualenvwrapper/virtualenvwrapper.sh \
&& workon catmaid \
&& pip install uwsgi" \
&& ln -s /home/scripts/docker/supervisor-catmaid.conf /etc/supervisor/conf.d/ \
&& chmod +x /home/scripts/docker/start-catmaid.sh \
&& chmod +x /home/scripts/docker/catmaid-entry.sh
# Fix AUFS bug that breaks PostgreSQL
# See: https://github.com/docker/docker/issues/783
RUN mkdir /etc/ssl/private-copy; \
mv /etc/ssl/private/* /etc/ssl/private-copy/; \
rm -r /etc/ssl/private; \
mv /etc/ssl/private-copy /etc/ssl/private; \
chmod -R 0700 /etc/ssl/private; \
chown -R postgres /etc/ssl/private
# Add Git commit build information to container
COPY .git/HEAD /home/.git/HEAD
COPY .git/refs /home/.git/refs
RUN cat /home/.git/$(cat /home/.git/HEAD | awk '{print $2}') > /home/git-commit
ENTRYPOINT ["/home/scripts/docker/catmaid-entry.sh"]
EXPOSE 8000
WORKDIR /home/django/projects/
CMD ["platform"]