2025-08-12 18:17:30 +02:00
|
|
|
# services/sales/Dockerfile
|
|
|
|
|
FROM python:3.11-slim
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Install system dependencies
|
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
|
gcc \
|
|
|
|
|
g++ \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
# Copy requirements and install Python dependencies
|
|
|
|
|
COPY services/sales/requirements.txt .
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
|
|
|
# Copy shared modules first
|
|
|
|
|
COPY shared/ /app/shared/
|
|
|
|
|
|
|
|
|
|
# Copy application code
|
|
|
|
|
COPY services/sales/app/ /app/app/
|
|
|
|
|
|
2025-09-30 13:32:51 +02:00
|
|
|
# Copy migrations and alembic config
|
|
|
|
|
COPY services/sales/migrations/ /app/migrations/
|
|
|
|
|
COPY services/sales/alembic.ini /app/alembic.ini
|
|
|
|
|
|
|
|
|
|
# Copy scripts directory
|
|
|
|
|
COPY scripts/ /app/scripts/
|
|
|
|
|
|
2025-08-12 18:17:30 +02:00
|
|
|
# Set Python path to include shared modules
|
|
|
|
|
ENV PYTHONPATH=/app
|
|
|
|
|
|
|
|
|
|
# Expose port
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
|
|
|
|
|
# Health check
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
|
|
|
|
CMD python -c "import requests; requests.get('http://localhost:8000/health', timeout=5)" || exit 1
|
|
|
|
|
|
|
|
|
|
# Run the application
|
|
|
|
|
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|