From 755bc66844f200e6b987bfecdfcadf821cf2144a Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Fri, 29 Jul 2022 22:22:22 +0100 Subject: [PATCH] Make project docker-ready --- Dockerfile | 18 ++++++++++++++++++ docker-compose.yml | 15 +++++++++++++++ requirements.txt | 1 + 3 files changed, 34 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..386012d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# syntax=docker/dockerfile:1 +FROM python:3 + +RUN useradd -d /code pathogen +RUN mkdir /code +RUN chown pathogen:pathogen /code + +RUN mkdir /venv +RUN chown pathogen:pathogen /venv + +USER pathogen +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 +WORKDIR /code +COPY requirements.prod.txt /code/ +RUN python -m venv /venv +RUN . /venv/bin/activate && pip install -r requirements.prod.txt +CMD . /venv/bin/activate && exec python manage.py runserver 0.0.0.0:8000 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..05c174f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: "2" + +services: + app: + image: pathogen/neptune + build: . + volumes: + - .:/code + ports: + - "8000:8000" + +networks: + default: + external: + name: pathogen \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2b41f35..2562843 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +wheel django pre-commit django-crispy-forms