23 lines
509 B
Docker
23 lines
509 B
Docker
FROM python:3.9-slim
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy requirements first (for better caching)
|
|
COPY requirements-api.txt .
|
|
|
|
# Install dependencies
|
|
RUN pip install --no-cache-dir -r requirements-api.txt
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Expose port
|
|
EXPOSE 4095
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:4095/health || exit 1
|
|
|
|
# Run the application with timeout protection
|
|
CMD ["timeout", "3600", "python", "app.py"] |