diff --git a/docker-compose.yml b/docker-compose.yml index e1b33a6..db5b9ec 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,6 @@ services: volumes: - db_data:/var/lib/postgresql/data - ./db/init:/docker-entrypoint-initdb.d:ro - ports: - - 5432:5432 networks: - docbot-network healthcheck: @@ -16,6 +14,11 @@ services: interval: 10s timeout: 5s retries: 5 + hostname: postgres + container_name: db + profiles: + - production + - development chat: build: context: . @@ -37,6 +40,8 @@ services: condition: service_healthy networks: - docbot-network + hostname: chatbot + container_name: chatbot profiles: - production - development @@ -53,12 +58,13 @@ services: - LOGGING_LEVEL=${LOGGING_LEVEL:-INFO} - PRODAMUS_TOKEN=${PRODAMUS_TOKEN} ports: - - "8000:8089" + - "127.0.0.1:8089:8089" depends_on: db: condition: service_healthy networks: - docbot-network + container_name: webhook profiles: - production - development diff --git a/docker/webhook/Dockerfile b/docker/webhook/Dockerfile index ac9b5ff..d446f68 100644 --- a/docker/webhook/Dockerfile +++ b/docker/webhook/Dockerfile @@ -3,9 +3,8 @@ FROM python:3.13-slim # Set environment variables ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 -ENV POETRY_NO_INTERACTION=1 -ENV POETRY_VENV_IN_PROJECT=1 -ENV POETRY_CACHE_DIR=/tmp/poetry_cache + +ENV PYTHONPATH="${PYTHONPATH}:/app/src" # Install system dependencies RUN apt-get update && apt-get install -y \ @@ -25,7 +24,7 @@ COPY pyproject.toml poetry.lock* ./ # Configure Poetry and install dependencies RUN poetry config virtualenvs.create false \ - && poetry install --only=main --no-dev \ + && poetry install --only=main --no-root \ && rm -rf $POETRY_CACHE_DIR # Copy application code @@ -44,4 +43,4 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8089/ || exit 1 # Run the webhook server -CMD ["uvicorn", "webhook.main:app", "--host", "0.0.0.0", "--port", "8089"] +CMD ["uvicorn", "webhook.main:app", "--app-dir", "/app/src", "--host", "0.0.0.0", "--port", "8089"] diff --git a/src/webhook/__init__.py b/src/webhook/__init__.py new file mode 100644 index 0000000..e69de29