From 0d633ab782ef0f4c5a68870411e74dc69f20720f Mon Sep 17 00:00:00 2001 From: adasauce Date: Wed, 22 Apr 2020 14:13:35 -0300 Subject: [PATCH] Add initial docker & docker-compose configuration probably doesn't work well yet. --- Dockerfile | 22 ++++++++++++++++ docker-compose.yml | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a56be2e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.8-slim + +RUN apt-get update && apt-get install -y --no-install-recommends \ + make \ + gcc \ + git \ + python3-dev \ + libffi-dev \ + libpq-dev \ + libyaml-dev + +ADD src/requirements.txt /requirements.txt + +RUN pip3 install -r /requirements.txt + +ADD src /fosspay +RUN cd /fosspay && \ + make + +ENV GUNICORN_CMD_ARGS "--bind 0.0.0.0:5000 --workers 2 --chdir /fosspay" + +CMD ["/usr/local/bin/gunicorn", "app:app"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8168add --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,66 @@ +version: "2.4" + +networks: + fosspay: + driver: bridge + driver_opts: + com.docker.network.bridge.name: br-fosspay + com.docker.network.driver.mtu: 1420 + enable_ipv6: false + +volumes: + postgres-data: + +services: + server: + restart: always + build: . + ports: + - "5000:5006" + networks: + - fosspay + links: + - postgres + volumes: + - ./config.ini:/fosspay/config.ini:ro + depends_on: + - postgres + + postgres: + image: postgres:11-alpine + restart: always + networks: + fosspay: + aliases: + - db + volumes: + - postgres-data:/var/lib/postgresql/data + env_file: env.postgres + + nginx: + image: nginx:alpine + ports: + - 8006:8006 + - 4448:4448 + restart: always + networks: + - fosspay + depends_on: + - server + volumes: + - /etc/localtime:/etc/localtime:ro + - ./nginx.conf:/etc/nginx/nginx.conf:ro + - ./run/letsencrypt/conf/:/etc/letsencrypt + - ./run/letsencrypt/html/:/tmp/letsencrypt + + letsencrypt: + image: vdhpieter/letsencrypt-webroot + restart: always + networks: + - fosspay + volumes: + - /etc/localtime:/etc/localtime:ro + - /var/run/docker.sock:/var/run/docker.sock + - ./run/letsencrypt/conf/:/etc/letsencrypt + - ./run/letsencrypt/html/:/tmp/letsencrypt + env_file: env.letsencrypt