# DSMS Gateway - REST API für dezentrales Speichersystem
FROM python:3.11-slim

LABEL maintainer="BreakPilot <dev@breakpilot.app>"
LABEL description="DSMS Gateway - REST API wrapper for IPFS"

WORKDIR /app

# Install curl for healthcheck and dependencies
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*

# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application
COPY . .

# Environment variables
ENV IPFS_API_URL=http://dsms-node:5001
ENV IPFS_GATEWAY_URL=http://dsms-node:8080
ENV PORT=8082

# Expose port
EXPOSE 8082

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  CMD curl -f http://localhost:8082/health || exit 1

# Run application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8082"]
