Merge pull request #130 from lanrat/master

Updated Dockerfile
This commit is contained in:
Matthew Scragg 2016-05-21 11:35:37 -05:00
commit 9fd2661405
2 changed files with 38 additions and 52 deletions

View file

@ -1,28 +1,48 @@
FROM realms/base FROM ubuntu:trusty
# Packages RUN apt-get update
RUN apt-get update && apt-get install -y build-essential python-pip python-virtualenv python-dev zlib1g-dev libffi-dev libyaml-dev libldap2-dev libsasl2-dev RUN apt-get install -y software-properties-common python-software-properties python-pip python-dev libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libyaml-dev libssl-dev libsasl2-dev libldap2-dev npm git python-virtualenv && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# lxml deps RUN ln -s /usr/bin/nodejs /usr/bin/node && \
# libxml2-dev libxslt1-dev npm install -g bower
# Virtualenv RUN useradd -ms /bin/bash wiki
RUN virtualenv /home/deploy/realms-wiki/.venv
RUN cd /home/deploy/realms-wiki && .venv/bin/pip install realms-wiki USER wiki
# Logging RUN git clone https://github.com/scragg0x/realms-wiki /home/wiki/realms-wiki
RUN mkdir /var/log/realms-wiki && chown deploy.deploy /var/log/realms-wiki
# Upstart WORKDIR /home/wiki/realms-wiki
RUN mkdir /etc/service/realms-wiki
ADD realms-wiki.sh /etc/service/realms-wiki/run
RUN chmod +x /etc/service/realms-wiki/run
# Clear some fat RUN virtualenv .venv && \
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* . .venv/bin/activate && \
pip install -r requirements.txt
# Hand over to deploy user RUN bower install
RUN chown -R deploy.deploy /home/deploy
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 REALMS_SQLALCHEMY_DATABASE_URI=${REALMS_DB_URI}
RUN mkdir /home/wiki/data && touch /home/wiki/data/.a
VOLUME /home/wiki/data
EXPOSE 5000 EXPOSE 5000
CMD . .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()'

View file

@ -1,34 +0,0 @@
#!/bin/bash
PATH=/home/deploy/realms-wiki/.venv/bin:/usr/local/bin:/usr/bin:/bin:$PATH
export PATH
LC_ALL=en_US.UTF-8
GEVENT_RESOLVER=ares
export LC_ALL
export GEVENT_RESOLVER
if [ "${REALMS_WIKI_CONFIG}" != "" ]; then
realms-wiki configure "${REALMS_WIKI_CONFIG}"
fi
if [ "${REALMS_WIKI_WORKERS}" == "" ]; then
REALMS_WIKI_WORKERS=3
fi
if [ "${REALMS_WIKI_PORT}" == "" ]; then
REALMS_WIKI_PORT=5000
fi
exec gunicorn \
--name realms-wiki \
--access-logfile - \
--error-logfile - \
--worker-class gevent \
--workers ${REALMS_WIKI_WORKERS} \
--bind 0.0.0.0:${REALMS_WIKI_PORT} \
--user deploy \
--group deploy \
--chdir /home/deploy/realms-wiki \
'realms:create_app()' >>/var/log/realms-wiki/realms-wiki.log 2>&1