diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..f4b11987 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git +.github diff --git a/Dockerfile b/Dockerfile index bd34055b..7001eebe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ FROM python:3.7-alpine -ENV NIGHTLY="" \ - DEBUG="False" \ +ENV DEBUG="False" \ SQLALCHEMY_DATABASE_URI="sqlite:////database/ihatemoney.db" \ SQLALCHEMY_TRACK_MODIFICATIONS="False" \ SECRET_KEY="tralala" \ @@ -19,12 +18,13 @@ ENV NIGHTLY="" \ BABEL_DEFAULT_TIMEZONE="UTC" \ GREENLET_TEST_CPP="no" -RUN apk update && apk add git gcc libc-dev libffi-dev openssl-dev wget &&\ - mkdir -p /etc/ihatemoney &&\ +RUN mkdir -p /etc/ihatemoney &&\ pip install --no-cache-dir gunicorn pymysql; -COPY ./conf/entrypoint.sh /entrypoint.sh +ADD . /src + +RUN pip install --no-cache-dir -e /src VOLUME /database EXPOSE 8000 -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["/src/conf/entrypoint.sh"] diff --git a/conf/entrypoint.sh b/conf/entrypoint.sh index c1b7019f..dfe5e12c 100755 --- a/conf/entrypoint.sh +++ b/conf/entrypoint.sh @@ -23,24 +23,6 @@ ACTIVATE_ADMIN_DASHBOARD = $ACTIVATE_ADMIN_DASHBOARD BABEL_DEFAULT_TIMEZONE = "$BABEL_DEFAULT_TIMEZONE" EOF -if [ "$NIGHTLY" == "True" -o "$NIGHTLY" == "true" ]; 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 PyPI. - pip install --no-cache-dir --upgrade ihatemoney -fi - # Start gunicorn without forking exec gunicorn ihatemoney.wsgi:application \ -b 0.0.0.0:8000 \ diff --git a/docs/installation.rst b/docs/installation.rst index c2475655..059fb291 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -207,7 +207,7 @@ With Docker Build the image:: - docker build -t ihatemoney --build-arg INSTALL_FROM_PYPI=True . + docker build -t ihatemoney . Start a daemonized Ihatemoney container:: @@ -233,7 +233,17 @@ A volume can also be specified to persist the default database file:: docker run -d -p 8000:8000 -v /host/path/to/database:/database ihatemoney -If you want to run the latest version, you can pass `-e NIGHTLY="true"`. +To enable the Admin dashboard, first generate a hashed password with:: + + docker run -it --rm --entrypoint ihatemoney ihatemoney generate_password_hash + +At the prompt, enter a password to use for the admin dashboard. The +command will print the hashed password string. + +Add these additional environment variables to the docker run invocation:: + + -e ACTIVATE_ADMIN_DASHBOARD=True \ + -e ADMIN_PASSWORD= \ Additional gunicorn parameters can be passed using the docker ``CMD`` parameter.