Files
bakery-ia/services/external/Dockerfile

60 lines
1.6 KiB
Docker
Raw Permalink Normal View History

2026-01-19 16:31:11 +01:00
# =============================================================================
# External Service Dockerfile - Environment-Configurable Base Images
# =============================================================================
# Build arguments for registry configuration:
# - BASE_REGISTRY: Registry URL (default: docker.io for Docker Hub)
# - PYTHON_IMAGE: Python image name and tag (default: python:3.11-slim)
# =============================================================================
ARG BASE_REGISTRY=docker.io
ARG PYTHON_IMAGE=python:3.11-slim
FROM ${BASE_REGISTRY}/${PYTHON_IMAGE} AS shared
2025-09-30 21:58:10 +02:00
WORKDIR /shared
COPY shared/ /shared/
2026-01-19 16:31:11 +01:00
ARG BASE_REGISTRY=docker.io
ARG PYTHON_IMAGE=python:3.11-slim
FROM ${BASE_REGISTRY}/${PYTHON_IMAGE}
2025-08-12 18:17:30 +02:00
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
g++ \
curl \
&& rm -rf /var/lib/apt/lists/*
2025-09-30 21:58:10 +02:00
# Copy requirements
COPY shared/requirements-tracing.txt /tmp/
2025-08-12 18:17:30 +02:00
COPY services/external/requirements.txt .
2025-09-30 21:58:10 +02:00
# Install Python dependencies
RUN pip install --no-cache-dir -r /tmp/requirements-tracing.txt
2025-08-12 18:17:30 +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-12 18:17:30 +02:00
# Copy application code
2025-09-30 21:58:10 +02:00
COPY services/external/ .
2025-09-30 13:32:51 +02:00
2025-09-30 08:12:45 +02:00
2025-09-30 21:58:10 +02:00
# Add shared libraries to Python path
ENV PYTHONPATH="/app:/app/shared:${PYTHONPATH:-}"
2025-08-12 18:17:30 +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 \
CMD curl -f http://localhost:8000/health || exit 1
2025-08-12 18:17:30 +02:00
2025-09-30 21:58:10 +02:00
# Run application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]