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 # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ libpq-dev \ curl \ && rm -rf /var/lib/apt/lists/* # Install Poetry RUN pip install poetry==2.1.4 # Set work directory WORKDIR /app # Copy Poetry configuration files COPY pyproject.toml poetry.lock* ./ # Configure Poetry and install dependencies RUN poetry config virtualenvs.create false \ && poetry install --only=main --no-dev \ && rm -rf $POETRY_CACHE_DIR # Copy application code COPY src/ ./src/ # Create non-root user RUN groupadd -r appuser && useradd -r -g appuser appuser RUN chown -R appuser:appuser /app USER appuser # Expose port EXPOSE 8089 # Health check 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"]