Files
bakery-ia/services/orders/Dockerfile

46 lines
997 B
Docker
Raw Normal View History

2025-09-30 21:58:10 +02:00
# Orders 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-21 20:28:14 +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-21 20:28:14 +02:00
&& rm -rf /var/lib/apt/lists/*
2025-09-30 21:58:10 +02:00
# Copy requirements
2025-08-21 20:28:14 +02:00
COPY services/orders/requirements.txt .
2025-09-30 21:58:10 +02:00
# Install Python dependencies
2025-08-21 20:28:14 +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-21 20:28:14 +02:00
# Copy application code
2025-09-30 21:58:10 +02:00
COPY services/orders/ .
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:-}"
ENV PYTHONUNBUFFERED=1
2025-09-30 13:32:51 +02:00
2025-08-21 20:28:14 +02:00
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
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"]