From 2470241f57e2bf7ed33fdc89bda512a1cd21efe2 Mon Sep 17 00:00:00 2001 From: mcbloch Date: Mon, 17 May 2021 21:42:11 +0200 Subject: [PATCH] Add docker, partialy from kers --- .dockerignore | 1 + Dockerfile | 12 ++++++++++++ docker-compose.yml | 17 +++++++++++++++++ requirements.txt | 2 ++ web.env | 10 ++++++++++ 5 files changed, 42 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 requirements.txt create mode 100644 web.env diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..49ef255 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +db.sqlite3 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..90c10c2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.8.5-alpine3.12 + +RUN mkdir code +WORKDIR code + +RUN apk add --no-cache gcc musl-dev linux-headers mariadb-dev + + +COPY requirements.txt requirements.txt +RUN pip install -r requirements.txt + +COPY . . diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..da59154 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +version: "3" +services: + web: + build: . + ports: + - "8000:8000" + env_file: "web.env" + restart: on-failure + volumes: + - mordor_db:/db.sqlite3 + - /var/www/mordor/static:/static + command: > + sh -c "python manage.py collectstatic --no-input + python manage.py migrate && + python manage.py runserver 0.0.0.0:8000" +volumes: + mordor_db: diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c48a5a4 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +Django==3.2 +requests==2.25.1 diff --git a/web.env b/web.env new file mode 100644 index 0000000..6e80618 --- /dev/null +++ b/web.env @@ -0,0 +1,10 @@ +DATABASE_HOST=database +SECRET_KEY=REPLACEME +DEBUG=1 +BASE_URL=http://localhost:8000 +OAUTH_CLIENT_ID=REPLACEME +OAUTH_CLIENT_SECRET=REPLACEME +MORDOR_ADMIN_USERNAME=replaceme +MORDOR_ADMIN_PASSWORD=replaceme +ALLOWED_HOSTS=localhost +STATIC_ROOT=/static