Compare commits

..

5 Commits

5 changed files with 28 additions and 4 deletions

5
.env.dev Normal file
View File

@ -0,0 +1,5 @@
SECRET_KEY=your_secret_key
DB_NAME=your_db_name
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_ROOT_PASSWORD=your_db_root_password

View File

@ -88,8 +88,8 @@ DATABASES = {
'NAME': os.getenv('DB_NAME'), 'NAME': os.getenv('DB_NAME'),
'USER': os.getenv('DB_USER'), 'USER': os.getenv('DB_USER'),
'PASSWORD': os.getenv('DB_PASSWORD'), 'PASSWORD': os.getenv('DB_PASSWORD'),
'HOST': os.getenv('DB_HOST'), 'HOST': 'db',
'PORT': os.getenv('DB_PORT'), 'PORT': '3306',
} }
} }

View File

@ -1,5 +1,5 @@
# Use an official Python runtime as a parent image # Use an official Python runtime as a parent image
FROM python:3.11-slim-bookworm FROM python:3.13-slim-trixie
# Set environment variables # Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONDONTWRITEBYTECODE=1

View File

@ -1,15 +1,34 @@
services: services:
db:
image: mariadb:12.2
env_file:
- .env
environment:
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
volumes:
- mariadb_data:/var/lib/mysql
restart: unless-stopped
django: django:
build: . build: .
env_file: env_file:
- .env - .env
volumes: volumes:
- .:/app - .:/app
restart: unless-stopped
ports: ports:
- "3030:3030" - "3030:3030"
network_mode: "host" depends_on:
- db
command: > command: >
sh -c "python manage.py makemigrations blog --noinput && sh -c "python manage.py makemigrations blog --noinput &&
python manage.py migrate --noinput && python manage.py migrate --noinput &&
python manage.py collectstatic --noinput && python manage.py collectstatic --noinput &&
gunicorn BH.wsgi:application --bind 0.0.0.0:3030 --workers ${GUNICORN_WORKERS:-3}" gunicorn BH.wsgi:application --bind 0.0.0.0:3030 --workers ${GUNICORN_WORKERS:-3}"
volumes:
mariadb_data:

Binary file not shown.