forked from catmaid/CATMAID
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
79 lines (71 loc) · 4.13 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
76
77
78
79
FROM ubuntu:20.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 apt-transport-https ca-certificates gnupg \
&& apt-get install -y gawk wget software-properties-common \
&& apt-get update -y \
&& wget --quiet -O - "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | gpg --dearmor | tee /usr/share/keyrings/com.rabbitmq.team.gpg > /dev/null \
&& wget --quiet -O - "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xf77f1eda57ebb1cc" | gpg --dearmor | tee /usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg > /dev/null \
&& wget --quiet -O - "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey" | gpg --dearmor | tee /usr/share/keyrings/io.packagecloud.rabbitmq.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg] http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu focal main" > /etc/apt/sources.list.d/rabbitmq.list \
&& echo "deb [signed-by=/usr/share/keyrings/io.packagecloud.rabbitmq.gpg] https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu focal main" >> /etc/apt/sources.list.d/rabbitmq.list \
&& wget --quiet -O - https://postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - > /dev/null \
&& add-apt-repository "deb https://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" \
&& add-apt-repository ppa:deadsnakes/ppa \
&& add-apt-repository -y ppa:nginx/stable \
&& apt-get update -y \
&& apt-get install -y python3.8 python3.8-dev git python3-pip \
&& apt-get install -y nginx supervisor \
&& apt-get install -y rabbitmq-server \
&& rm -rf /var/lib/apt/lists/*
COPY packagelist-ubuntu-apt.txt /home/
RUN apt-get update -y \
&& xargs apt-get install -y < /home/packagelist-ubuntu-apt.txt \
&& rm -rf /var/lib/apt/lists/*
COPY django/requirements.txt django/requirements-async.txt django/requirements-production.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.8 \
&& workon catmaid \
&& pip install -U pip setuptools \
&& pip install -r /home/django/requirements.txt \
&& pip install -r /home/django/requirements-async.txt \
&& pip install -r /home/django/requirements-production.txt \
"
COPY . /home/
# Add Git commit build information to container by copying the Git repo (.git
# folder) into the container to run "git describe" and pipe its result in the
# file /home/git-version. After this is done, the repo is removed again from the
# container. We expect the environment to have a full git history, including
# tags. For DockerHub this is ensured with a post_checkout hook.
COPY .git /home/.git
RUN cd /home/ && git describe > /home/git-version && rm -r /home/.git
# 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/ \
&& mkdir -p /var/run/catmaid \
&& chown www-data /var/run/catmaid \
&& chmod +x /home/scripts/docker/start-catmaid.sh \
&& chmod +x /home/scripts/docker/start-celery.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
ENTRYPOINT ["/home/scripts/docker/catmaid-entry.sh"]
EXPOSE 8000
WORKDIR /home/django/projects/
CMD ["platform"]