34 lines
877 B
Docker
34 lines
877 B
Docker
# Use Python 3.10 slim image as base
|
|
FROM python:3.10-slim
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
POETRY_VERSION=1.7.1
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
gcc \
|
|
python3-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements file
|
|
COPY requirements.txt .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Expose the port the app runs on
|
|
EXPOSE 8888
|
|
|
|
# Command to run the application
|
|
# Must use port 8888. Using a different port will cause Prometheus metrics collection to fail,
|
|
# and metrics data will not be visible on the ops page of the freeleaps.com platform.
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8888"] |