From 6b0b5fae076ba51c6c536b541e8f137039d8f915 Mon Sep 17 00:00:00 2001 From: Philipp Le Date: Sat, 19 Sep 2020 22:54:48 +0200 Subject: Added Docker Compose * Added Docker compose file * Added postgresql to Docker image --- Dockerfile | 3 ++- conf/entrypoint.sh | 3 ++- docker-compose.yml | 21 +++++++++++++++++++++ setup.cfg | 1 + 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index bd34055..03255a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,11 +19,12 @@ ENV NIGHTLY="" \ BABEL_DEFAULT_TIMEZONE="UTC" \ GREENLET_TEST_CPP="no" -RUN apk update && apk add git gcc libc-dev libffi-dev openssl-dev wget &&\ +RUN apk update && apk add git gcc libc-dev libffi-dev openssl-dev wget postgresql-dev &&\ mkdir -p /etc/ihatemoney &&\ pip install --no-cache-dir gunicorn pymysql; COPY ./conf/entrypoint.sh /entrypoint.sh +COPY ./ /ihatemoney/ VOLUME /database EXPOSE 8000 diff --git a/conf/entrypoint.sh b/conf/entrypoint.sh index c1b7019..8fc10f5 100755 --- a/conf/entrypoint.sh +++ b/conf/entrypoint.sh @@ -38,7 +38,8 @@ if [ "$NIGHTLY" == "True" -o "$NIGHTLY" == "true" ]; then pip install --no-cache-dir -e /ihatemoney else # Get the latest release from PyPI. - pip install --no-cache-dir --upgrade ihatemoney + #pip install --no-cache-dir --upgrade ihatemoney + pip install --no-cache-dir -e /ihatemoney fi # Start gunicorn without forking diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2d2576a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +version: "3.8" +services: + ihatemoney: + build: + context: . + dockerfile: Dockerfile + restart: unless-stopped + ports: + - 18000:8000 + environment: + SQLALCHEMY_DATABASE_URI: "postgresql://ihatemoney:ihatemoney@db/ihatemoney?client_encoding=utf8" + db: + image: postgres:13 + restart: unless-stopped + environment: + POSTGRES_USER: "ihatemoney" + POSTGRES_PASSWORD: "ihatemoney" + POSTGRES_DB: "ihatemoney" + PGDATA: "/var/lib/postgresql/data/pgdata" + volumes: + - ./db:/var/lib/postgresql/data/pgdata diff --git a/setup.cfg b/setup.cfg index 0b49a79..b8cdbc1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,6 +41,7 @@ install_requires = requests~=2.22 SQLAlchemy-Continuum~=1.3 SQLAlchemy~=1.3.0 # New 1.4 changes API, see #728 + psycopg2-binary~=2.8 [options.extras_require] dev = -- cgit v1.1