30 lines
757 B
Docker
30 lines
757 B
Docker
FROM python:3.12-slim-bookworm
|
|
|
|
# Install curl and ca-certificates for uv installer
|
|
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Download and install uv
|
|
ADD https://astral.sh/uv/install.sh /uv-installer.sh
|
|
RUN sh /uv-installer.sh && rm /uv-installer.sh
|
|
|
|
# Ensure uv is on PATH
|
|
ENV PATH="/root/.local/bin/:$PATH"
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy dependency files first (for better layer caching)
|
|
COPY pyproject.toml uv.lock* ./
|
|
|
|
# Install dependencies
|
|
RUN uv sync --frozen --no-dev
|
|
|
|
# Copy application code
|
|
COPY app ./app
|
|
|
|
# Expose port
|
|
EXPOSE 7999
|
|
|
|
# Run the application using uv
|
|
CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7999"] |