From d65e9a415b44ca2877978ff37820dece614d9ceb Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 7 Nov 2021 22:25:04 -0700 Subject: [PATCH] Move Docker stuff to its own directory --- docker/Dockerfile | 12 ++++++++++++ docker/docker-compose.example.yaml | 21 +++++++++++++++++++++ docker/nginx.conf | 10 ++++++++++ 3 files changed, 43 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/docker-compose.example.yaml create mode 100644 docker/nginx.conf diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..b578c4f --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3 + +RUN useradd --system --gid root --uid 1001 uwsgi +RUN pip install uwsgi psycopg2_binary Flask Flask-Admin Flask-SQLAlchemy Flask-Bcrypt \ + Flask-Security-Too bcrypt email_validator pyyaml rst2html +RUN mkdir -p /app +WORKDIR /app +COPY . /app + +EXPOSE 3031 +CMD ["uwsgi", "--master", "--workers", "4", "--socket", "0.0.0.0:3031", "--protocol", "uwsgi", \ + "--plugin", "python3", "--uid", "uwsgi", "--wsgi", "libertywiki.wsgi"] diff --git a/docker/docker-compose.example.yaml b/docker/docker-compose.example.yaml new file mode 100644 index 0000000..8b6db8f --- /dev/null +++ b/docker/docker-compose.example.yaml @@ -0,0 +1,21 @@ +version: '3' +services: + wiki: + build: + context: . + environment: + - SQLALCHEMY_DATABASE_URI=postgresql://wiki:wiki@postgres/wiki + - SECRET_KEY=super-secret-key-replace-me + - SECURITY_PASSWORD_SALT=password-salt-replace-me + postgres: + image: postgres:14 + environment: + - POSTGRES_USER=wiki + - POSTGRES_PASSWORD=wiki + - POSTGRES_DB=wiki + nginx: + image: nginx + volumes: + - "./nginx.conf:/etc/nginx/conf.d/default.conf:ro" + ports: + - "8000:80" diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 0000000..402dbc9 --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,10 @@ +server { + listen 80; + listen [::]:80; + server_name _; + + location / { + include uwsgi_params; + uwsgi_pass wiki:3031; + } +}