mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 17:32:38 +02:00
Change Dockerfile to compile python dependencies at build time.
- Updated entrypoint.sh - Updated docs for running with Docker - Added .dockerignore
This commit is contained in:
parent
078f9e8b6b
commit
942617a436
4 changed files with 20 additions and 26 deletions
2
.dockerignore
Normal file
2
.dockerignore
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
.git
|
||||||
|
.github
|
12
Dockerfile
12
Dockerfile
|
@ -1,7 +1,6 @@
|
||||||
FROM python:3.7-alpine
|
FROM python:3.7-alpine
|
||||||
|
|
||||||
ENV NIGHTLY="" \
|
ENV DEBUG="False" \
|
||||||
DEBUG="False" \
|
|
||||||
SQLALCHEMY_DATABASE_URI="sqlite:////database/ihatemoney.db" \
|
SQLALCHEMY_DATABASE_URI="sqlite:////database/ihatemoney.db" \
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS="False" \
|
SQLALCHEMY_TRACK_MODIFICATIONS="False" \
|
||||||
SECRET_KEY="tralala" \
|
SECRET_KEY="tralala" \
|
||||||
|
@ -19,12 +18,13 @@ ENV NIGHTLY="" \
|
||||||
BABEL_DEFAULT_TIMEZONE="UTC" \
|
BABEL_DEFAULT_TIMEZONE="UTC" \
|
||||||
GREENLET_TEST_CPP="no"
|
GREENLET_TEST_CPP="no"
|
||||||
|
|
||||||
RUN apk update && apk add git gcc libc-dev libffi-dev openssl-dev wget &&\
|
RUN mkdir -p /etc/ihatemoney &&\
|
||||||
mkdir -p /etc/ihatemoney &&\
|
|
||||||
pip install --no-cache-dir gunicorn pymysql;
|
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
|
VOLUME /database
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/src/conf/entrypoint.sh"]
|
||||||
|
|
|
@ -23,24 +23,6 @@ ACTIVATE_ADMIN_DASHBOARD = $ACTIVATE_ADMIN_DASHBOARD
|
||||||
BABEL_DEFAULT_TIMEZONE = "$BABEL_DEFAULT_TIMEZONE"
|
BABEL_DEFAULT_TIMEZONE = "$BABEL_DEFAULT_TIMEZONE"
|
||||||
EOF
|
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
|
# Start gunicorn without forking
|
||||||
exec gunicorn ihatemoney.wsgi:application \
|
exec gunicorn ihatemoney.wsgi:application \
|
||||||
-b 0.0.0.0:8000 \
|
-b 0.0.0.0:8000 \
|
||||||
|
|
|
@ -207,7 +207,7 @@ With Docker
|
||||||
|
|
||||||
Build the image::
|
Build the image::
|
||||||
|
|
||||||
docker build -t ihatemoney --build-arg INSTALL_FROM_PYPI=True .
|
docker build -t ihatemoney .
|
||||||
|
|
||||||
Start a daemonized Ihatemoney container::
|
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
|
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=<hashed_password_string> \
|
||||||
|
|
||||||
Additional gunicorn parameters can be passed using the docker ``CMD``
|
Additional gunicorn parameters can be passed using the docker ``CMD``
|
||||||
parameter.
|
parameter.
|
||||||
|
|
Loading…
Reference in a new issue