2025-09-30 21:58:10 +02:00
|
|
|
# Recipes Dockerfile
|
|
|
|
|
# Add this stage at the top of each service Dockerfile
|
|
|
|
|
FROM python:3.11-slim AS shared
|
|
|
|
|
WORKDIR /shared
|
|
|
|
|
COPY shared/ /shared/
|
|
|
|
|
|
|
|
|
|
# Then your main service stage
|
2025-08-13 17:39:35 +02:00
|
|
|
FROM python:3.11-slim
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Install system dependencies
|
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
|
gcc \
|
2025-09-30 21:58:10 +02:00
|
|
|
curl \
|
2025-08-13 17:39:35 +02:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2025-09-30 21:58:10 +02:00
|
|
|
# Copy requirements
|
2025-10-15 16:12:49 +02:00
|
|
|
COPY shared/requirements-tracing.txt /tmp/
|
|
|
|
|
|
2025-08-15 18:09:35 +02:00
|
|
|
COPY services/recipes/requirements.txt .
|
2025-09-30 21:58:10 +02:00
|
|
|
|
|
|
|
|
# Install Python dependencies
|
2025-10-15 16:12:49 +02:00
|
|
|
RUN pip install --no-cache-dir -r /tmp/requirements-tracing.txt
|
|
|
|
|
|
2025-08-13 17:39:35 +02:00
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
2025-09-30 21:58:10 +02:00
|
|
|
# Copy shared libraries from the shared stage
|
|
|
|
|
COPY --from=shared /shared /app/shared
|
2025-08-13 17:39:35 +02:00
|
|
|
|
|
|
|
|
# Copy application code
|
2025-09-30 21:58:10 +02:00
|
|
|
COPY services/recipes/ .
|
2025-09-30 13:32:51 +02:00
|
|
|
|
2025-10-12 18:47:33 +02:00
|
|
|
|
2025-09-30 13:32:51 +02:00
|
|
|
|
2025-09-30 21:58:10 +02:00
|
|
|
# Add shared libraries to Python path
|
|
|
|
|
ENV PYTHONPATH="/app:/app/shared:${PYTHONPATH:-}"
|
2025-08-13 17:39:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# Expose port
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
|
|
|
|
|
# Health check
|
2025-09-30 21:58:10 +02:00
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
2025-08-13 17:39:35 +02:00
|
|
|
CMD curl -f http://localhost:8000/health || exit 1
|
|
|
|
|
|
2025-09-30 21:58:10 +02:00
|
|
|
# Run application
|
|
|
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|