-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (34 loc) · 1.41 KB
/
Dockerfile
File metadata and controls
53 lines (34 loc) · 1.41 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
53
# syntax=docker/dockerfile:1
FROM python:3.14-slim AS base
WORKDIR /app
# Install uv for faster package installation
RUN pip install --no-cache-dir uv==0.9.26
# Copy only dependency metadata first (cached unless pyproject.toml changes)
COPY pyproject.toml README.md ./
# Create stub package structure for dependency resolution
RUN mkdir -p src/squishmark && touch src/squishmark/__init__.py
# Install production dependencies only (this layer is cached)
# Cache mount persists uv's download cache between builds
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --system .
# Now copy actual source code (changes frequently, but deps are cached)
COPY src/ src/
# Reinstall with real source (deps already cached, this is fast)
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --system .
# Development stage - includes test dependencies (NOT lint tools)
FROM base AS dev
# Create data directory for SQLite database
RUN mkdir -p /data
# Install test dependencies only - ruff/pyright run locally, not in container
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --system ".[test]"
COPY . .
EXPOSE 8000
CMD ["uvicorn", "squishmark.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
# Production stage - minimal image
FROM base AS prod
COPY themes/ themes/
RUN mkdir -p /data
EXPOSE 8000
CMD ["uvicorn", "squishmark.main:app", "--host", "0.0.0.0", "--port", "8000"]