-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.debug
More file actions
52 lines (38 loc) · 1.4 KB
/
Dockerfile.debug
File metadata and controls
52 lines (38 loc) · 1.4 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Dockerfile.debug - FastAPI app with remote debugging support
FROM python:3.13-slim as builder
# Install uv for dependency management
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
WORKDIR /app
# Copy dependency files
COPY pyproject.toml uv.lock* README.md ./
# Install dependencies including debugpy
RUN uv sync --frozen && \
uv pip install debugpy
FROM python:3.13-slim
# Install runtime dependencies
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
libpq5 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy uv for runtime
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
WORKDIR /app
# Copy dependencies and app
COPY pyproject.toml uv.lock* README.md ./
COPY --from=builder /app/.venv /app/.venv
COPY app app
# Create non-root user with proper home directory
RUN addgroup --system --gid 1001 appgroup && \
adduser --system --uid 1001 --ingroup appgroup --home /home/appuser appuser && \
mkdir -p /home/appuser/.cache && \
chown -R appuser:appgroup /app /home/appuser
# Set up environment
ENV UV_CACHE_DIR=/home/appuser/.cache/uv
ENV HOME=/home/appuser
ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONPATH=/app
USER appuser
# Expose debug port
EXPOSE 5678 8000
# Start with debugpy listening on port 5678
CMD ["python", "-m", "debugpy", "--listen", "0.0.0.0:5678", "--wait-for-client", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]