-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (23 loc) · 868 Bytes
/
Copy pathDockerfile
File metadata and controls
35 lines (23 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
FROM python:3.13-slim
# Set environment variables consistently
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
UV_PROJECT_ENVIRONMENT="/usr/local/" \
# Ensure scripts know where the app root is
PYTHONPATH="/app"
# Install uv package manager
# Install in /usr/local/bin as it is a "local" software
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
WORKDIR /app
# Copy and install dependencies first for caching efficiency
COPY pyproject.toml uv.lock* ./
RUN uv sync --no-dev --frozen --no-cache
COPY . /app
RUN chmod +x scripts/* || true
# Create and switch to a non-root user
RUN useradd -ms /bin/bash appuser
USER appuser
# Make port 8000 available (adjust if your API uses a different port)
EXPOSE 8000
# Default command (no reload in production)
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]