mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 09:22:38 +02:00
[docker] Download IHM from Pypy or reference git repo;
This creates two modes to run the Docker image: - either in non-NIGHTLY mode, the latest version will be installed from pypy. - or in Nightly mode, it will clone the repository and update it every time the instance is restarted. It also updates Python to 3.7, for additional goodness.
This commit is contained in:
parent
89e78bb4d0
commit
9a889f61c7
2 changed files with 35 additions and 17 deletions
29
Dockerfile
29
Dockerfile
|
@ -1,18 +1,7 @@
|
|||
FROM python:3.6-alpine
|
||||
FROM python:3.7-alpine
|
||||
|
||||
RUN apk update && apk add gcc libc-dev libffi-dev openssl-dev &&\
|
||||
mkdir /ihatemoney &&\
|
||||
mkdir -p /etc/ihatemoney &&\
|
||||
pip install --no-cache-dir gunicorn pymysql
|
||||
|
||||
COPY . /ihatemoney
|
||||
ARG INSTALL_FROM_PYPI="False"
|
||||
RUN if [ "$INSTALL_FROM_PYPI" = True ]; then\
|
||||
pip install --no-cache-dir ihatemoney ; else\
|
||||
pip install --no-cache-dir -e /ihatemoney ; \
|
||||
fi
|
||||
|
||||
ENV DEBUG="False" \
|
||||
ENV NIGHTLY="" \
|
||||
DEBUG="False" \
|
||||
SQLALCHEMY_DATABASE_URI="sqlite:////database/ihatemoney.db" \
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS="False" \
|
||||
SECRET_KEY="tralala" \
|
||||
|
@ -21,13 +10,19 @@ ENV DEBUG="False" \
|
|||
MAIL_PORT=25 \
|
||||
MAIL_USE_TLS=False \
|
||||
MAIL_USE_SSL=False \
|
||||
MAIL_USERNAME=None \
|
||||
MAIL_PASSWORD=None \
|
||||
MAIL_USERNAME= \
|
||||
MAIL_PASSWORD= \
|
||||
ACTIVATE_DEMO_PROJECT="True" \
|
||||
ADMIN_PASSWORD="" \
|
||||
ALLOW_PUBLIC_PROJECT_CREATION="True" \
|
||||
ACTIVATE_ADMIN_DASHBOARD="False"
|
||||
|
||||
RUN apk update && apk add git gcc libc-dev libffi-dev openssl-dev wget &&\
|
||||
mkdir -p /etc/ihatemoney &&\
|
||||
pip install --no-cache-dir gunicorn pymysql;
|
||||
|
||||
COPY ./conf/entrypoint.sh /entrypoint.sh
|
||||
|
||||
VOLUME /database
|
||||
EXPOSE 8000
|
||||
ENTRYPOINT ["/ihatemoney/conf/confandrun.sh"]
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Fail the whole script on the first failure.
|
||||
set -e
|
||||
|
||||
cat <<EOF > /etc/ihatemoney/ihatemoney.cfg
|
||||
DEBUG = $DEBUG
|
||||
SQLALCHEMY_DATABASE_URI = "$SQLALCHEMY_DATABASE_URI"
|
||||
|
@ -17,6 +21,25 @@ ADMIN_PASSWORD = '$ADMIN_PASSWORD'
|
|||
ALLOW_PUBLIC_PROJECT_CREATION = $ALLOW_PUBLIC_PROJECT_CREATION
|
||||
ACTIVATE_ADMIN_DASHBOARD = $ACTIVATE_ADMIN_DASHBOARD
|
||||
EOF
|
||||
|
||||
if [ ! -z "$NIGHTLY" ]; then
|
||||
# Clone or update repository into /ihatemoney.
|
||||
if [ ! -d /ihatemoney/.git ]; then
|
||||
echo "Cloning..."
|
||||
git clone --depth 1 https://github.com/spiral-project/ihatemoney /ihatemoney
|
||||
echo "Done cloning."
|
||||
else
|
||||
cd /ihatemoney
|
||||
echo "Updating..."
|
||||
git pull || echo "Couldn't update; maybe Github is unreachable?"
|
||||
echo "Done updating."
|
||||
fi
|
||||
pip install --no-cache-dir -e /ihatemoney
|
||||
else
|
||||
# Get the latest release from PyPy.
|
||||
pip install --no-cache-dir --upgrade ihatemoney
|
||||
fi
|
||||
|
||||
# Start gunicorn without forking
|
||||
exec gunicorn ihatemoney.wsgi:application \
|
||||
-b 0.0.0.0:8000 \
|
Loading…
Reference in a new issue