-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (30 loc) · 1.32 KB
/
Dockerfile
File metadata and controls
41 lines (30 loc) · 1.32 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
# Free Claude Code - Dockerfile
# Alpine-based multi-stage build for minimal image
# ============================================
# Stage 1: Build stage
# ============================================
FROM python:3.14-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache gcc musl-dev libffi-dev openssl-dev
# Install uv and dependencies
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
COPY pyproject.toml uv.lock ./
RUN UV_PROJECT_ENVIRONMENT=/usr/local uv sync --frozen --no-install-project --no-dev --no-cache
# ============================================
# Stage 2: Runtime stage (minimal)
# ============================================
FROM python:3.14-alpine
WORKDIR /app
# Copy installed packages and uvicorn from builder
COPY --from=builder /usr/local/lib/python3.14/site-packages /usr/local/lib/python3.14/site-packages
COPY --from=builder /usr/local/bin/uvicorn /usr/local/bin/
# Copy application code
COPY . .
# Expose the default port
EXPOSE 8082
# Health check (local-only endpoint)
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8082/health')" || exit 1
# Run the server
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8082", "--timeout-graceful-shutdown", "5"]