-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathDockerfile
executable file
·67 lines (50 loc) · 1.86 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
FROM ubuntu:xenial
ENV DEBIAN_FRONTEND noninteractive
# install prereqs
RUN apt-get -qq update && \
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
apt-get install -y sudo git curl python-pip python-dev libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libyaml-dev libssl-dev libsasl2-dev libldap2-dev
# install pipenv
RUN pip install -U pipenv
# install node
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g bower clean-css@3
# clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# create wiki user
RUN useradd -ms /bin/bash wiki && gpasswd -a wiki sudo
# copy the cloned repo recursively
COPY ./ /home/wiki/realms-wiki/
RUN chown -R wiki:wiki /home/wiki && \
echo "wiki:wiki" | chpasswd && \
echo "wiki ALL=(ALL:ALL) NOPASSWD: ALL" | tee -a /etc/sudoers
USER wiki
WORKDIR /home/wiki/realms-wiki/
ENV WORKERS=3
ENV GEVENT_RESOLVER=ares
ENV REALMS_ENV=docker
ENV REALMS_WIKI_PATH=/home/wiki/data/repo
ENV REALMS_DB_URI='sqlite:////home/wiki/data/wiki.db'
ENV PIPENV_VENV_IN_PROJECT=1
RUN pipenv install --two --dev && \
bower --config.interactive=false install && \
mkdir /home/wiki/data
RUN pipenv run python setup.py install
VOLUME /home/wiki/data
EXPOSE 5000
RUN /home/wiki/realms-wiki/.venv/bin/realms-wiki create_db && \
echo '#!/bin/bash \n\
/home/wiki/realms-wiki/.venv/bin/realms-wiki $@ \n' >> /tmp/realms-wiki && \
sudo mv /tmp/realms-wiki /usr/local/bin && \
sudo chmod +x /usr/local/bin/realms-wiki
CMD . /home/wiki/realms-wiki/.venv/bin/activate && \
gunicorn \
--name realms-wiki \
--access-logfile - \
--error-logfile - \
--worker-class gevent \
--workers ${WORKERS} \
--bind 0.0.0.0:5000 \
--chdir /home/wiki/realms-wiki \
'realms:create_app()'