diff --git a/app/prod/Dockerfile b/app/prod/Dockerfile new file mode 100644 index 00000000..6978ba86 --- /dev/null +++ b/app/prod/Dockerfile @@ -0,0 +1,21 @@ +FROM python:3.11-alpine + +# set work directory +WORKDIR /usr/src/app + +# set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# install system dependencies +RUN apk update && \ + apk add --no-cache netcat-openbsd gcc postgresql graphviz musl-dev libffi-dev + +# install dependencies +RUN pip install --no-cache-dir pip~=21.3.1 +COPY ./requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# # copy entrypoint.sh +ENTRYPOINT ["./entrypoint.sh"] + diff --git a/app/prod/requirements.txt b/app/prod/requirements.txt new file mode 100644 index 00000000..2c108f9a --- /dev/null +++ b/app/prod/requirements.txt @@ -0,0 +1,14 @@ +black~=22.3.0 +cryptography~=37.0.2 +Django~=4.0.1 +django-extensions~=3.1.5 +django-linear-migrations~=2.12.0 +django-phonenumber-field[phonenumbers]~=6.3.0 +django-timezone-field==5.0 +djangorestframework~=3.13.1 +drf-jwt~=1.19.2 +drf-spectacular==0.22.1 +psycopg2-binary~=2.9.3 +pydot~=1.4.2 +pytz==2022.1 +tzdata==2022.1 diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 00000000..d5f238aa --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,27 @@ +version: '3.8' + +services: + db: + image: postgres:13.0-alpine + volumes: + - postgres_data:/var/lib/postgresql/data/ + environment: + - POSTGRES_USER=people_depot + - POSTGRES_PASSWORD=people_depot + - POSTGRES_DB=people_depot_dev + container_name: people_depot_db + web: + build: ./app/prod + command: python manage.py runserver 0.0.0.0:8000 + volumes: + - ./app/:/usr/src/app/ + ports: + - 8000:8000 + env_file: + - ./.env.dev + container_name: people_depot_app_prod + depends_on: + - db +volumes: + postgres_data: + diff --git a/docker-compose.yml b/docker-compose.yml index 3342984b..9c4880ad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,7 @@ services: - 8000:8000 env_file: - ./.env.dev + container_name: people_depot_dev depends_on: - db db: @@ -20,6 +21,7 @@ services: - POSTGRES_USER=people_depot - POSTGRES_PASSWORD=people_depot - POSTGRES_DB=people_depot_dev - + container_name: people_depot_db_dev volumes: postgres_data: +