-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (27 loc) · 950 Bytes
/
Copy pathDockerfile
File metadata and controls
38 lines (27 loc) · 950 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
36
37
38
FROM python:3.14-slim
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
curl \
build-essential \
libpq-dev \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd --create-home --shell /bin/bash appuser
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Copy ONLY dependency files first (better caching - changes infrequently)
COPY pyproject.toml uv.lock ./
# Export and install dependencies from lock file (cached layer when deps don't change)
RUN uv export --no-hashes --all-extras --no-emit-project > requirements.txt && \
uv pip install --system --no-cache -r requirements.txt
# Copy application code (changes frequently - separate layer)
COPY . .
RUN chown -R appuser:appuser /app
USER appuser
EXPOSE 8000