diff --git a/.env_example b/.env_example index c7e2866..f7f3e1a 100644 --- a/.env_example +++ b/.env_example @@ -18,4 +18,9 @@ DEFAULT_DB_USER=demo DEFAULT_DB_NAME=demo DEFAULT_DB_PORT=5432 +MQ_AMQP_PORT=5672 +MQ_MGMT_PORT=15672 +MQ_DEFAULT_USER=demo +MQ_DEFAULT_PASS=91fb8e9e009f5b9ce1854d947e6fe4a3 + REDIS_DEFAULT_PASS=cfe1c2c4703abb205d71abdc07cc3f3d diff --git a/Dockerfile b/Dockerfile index e69de29..c0944c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM python:3.12-slim-bullseye as base + +FROM base AS install + +WORKDIR /home/app +ENV PYTHONPATH=/home/app PYTHONHASHSEED=0 + + +COPY alembic.ini .env requirements.lock pyproject.toml README.md ./ +COPY src/ src/ +COPY alembic/ alembic/ +RUN chmod 755 .env +RUN PYTHONDONTWRITEBYTECODE=1 pip install -r requirements.lock +RUN alembic upgrade head + +CMD ["python", "src/__main__.py"] diff --git a/alembic/env.py b/alembic/env.py index a6f6879..9236831 100644 --- a/alembic/env.py +++ b/alembic/env.py @@ -9,7 +9,7 @@ from src.core import config as app_config from src.core.models.base import Base -from src.features.auth.models import * # noqa: F403 +from src.features.admin.models import * # noqa: F403 # this is the Alembic Config object, which provides diff --git a/docker-compose.yaml b/docker-compose.yaml index 1342ec4..be9820c 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -12,6 +12,8 @@ services: - .env postgres: image: postgres:latest + restart: unless-stopped + container_name: "postgres" ports: - "${DEFAULT_DB_PORT}:5432" volumes: @@ -22,3 +24,32 @@ services: - POSTGRES_DB=${DEFAULT_DB_NAME} env_file: - .env + + rabbitmq: + image: rabbitmq:3.13.3-management + container_name: "rabbitmq" + restart: unless-stopped + ports: + - "${MQ_AMQP_PORT}:5672" + - "${MQ_MGMT_PORT}:15672" + volumes: + - ./data/rabbitmq:/var/lib/rabbitmq + environment: + - RABBITMQ_DEFAULT_USER=${MQ_DEFAULT_USER} + - RABBITMQ_DEFAULT_PASS=${MQ_DEFAULT_PASS} + env_file: + - .env + # app: + # depends_on: + # - redis + # - postgres + # - rabbitmq + # build: + # context: . + # dockerfile: ./Dockerfile + # container_name: "app" + # restart: unless-stopped + # ports: + # - "${APP_PORT}:8000" + # volumes: + # - ./data/app:/var/lib/app