DOCKER
This commit is contained in:
12
.dockerignore
Normal file
12
.dockerignore
Normal file
@@ -0,0 +1,12 @@
|
||||
__pycache__
|
||||
*.pyc
|
||||
*.db
|
||||
*.sqlite3
|
||||
env/
|
||||
venv/
|
||||
.git
|
||||
*.log
|
||||
*.pot
|
||||
*.mo
|
||||
*.po
|
||||
.DS_Store
|
||||
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM python:3.8-slim
|
||||
LABEL authors="Salen, sorry for code"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Копируем зависимости
|
||||
COPY requirements.txt .
|
||||
|
||||
# Устанавливаем зависимости
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Копируем весь код проекта
|
||||
COPY . .
|
||||
|
||||
# Команда, которая будет выполняться при запуске контейнера
|
||||
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "tisbiProFi.wsgi:application"]
|
||||
32
docker-compose.yml
Normal file
32
docker-compose.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
command: gunicorn tisbiProFi.wsgi:application --bind 0.0.0.0:8000
|
||||
volumes:
|
||||
- static_volume:/app/staticfiles
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- LOCALDEV=true
|
||||
- DB_NAME=profi
|
||||
- DB_USER=profi
|
||||
- DB_PASSWORD=iojdasioiodj09392jdsa0
|
||||
- DB_HOST=db
|
||||
- DB_PORT=5432
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
db:
|
||||
image: postgres:16
|
||||
environment:
|
||||
POSTGRES_DB: profi
|
||||
POSTGRES_USER: profi
|
||||
POSTGRES_PASSWORD: iojdasioiodj09392jdsa0
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data/
|
||||
|
||||
volumes:
|
||||
static_volume:
|
||||
postgres_data:
|
||||
@@ -1,4 +1,6 @@
|
||||
django~=4.2.21
|
||||
Django==4.2.7
|
||||
gunicorn==21.2.0
|
||||
psycopg2-binary==2.9.9
|
||||
django-cors-headers
|
||||
djangorestframework
|
||||
drf-yasg
|
||||
|
||||
@@ -24,7 +24,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
SECRET_KEY = 'django-insecure-g*su%0=3d!dh^d#!@f1xow-@v#fuwr$#rsvl!if^r002s1=!t8'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True # bool(os.environ.get('LOCALDEV', False))
|
||||
DEBUG = bool(os.environ.get('LOCALDEV', False))
|
||||
|
||||
ALLOWED_HOSTS = [
|
||||
'localhost',
|
||||
@@ -176,7 +176,7 @@ REST_FRAMEWORK = {
|
||||
"DEFAULT_VERSION": "v1",
|
||||
|
||||
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
|
||||
"PAGE_SIZE": 10,
|
||||
"PAGE_SIZE": 100,
|
||||
|
||||
"DEFAULT_FILTER_BACKENDS": ["django_filters.rest_framework.DjangoFilterBackend"],
|
||||
|
||||
|
||||
Reference in New Issue
Block a user