-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (28 loc) · 1.41 KB
/
Copy pathDockerfile
File metadata and controls
37 lines (28 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
# FastAPI app image. GraphHopper has its own image — see graphhopper/Dockerfile.
#
# uv is used inside the container for the same reason it's used outside: the
# lockfile is the source of truth, so the container gets byte-identical
# dependencies to a local `uv sync` rather than whatever pip resolves today.
FROM ghcr.io/astral-sh/uv:python3.14-bookworm-slim
WORKDIR /app
ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_PYTHON_DOWNLOADS=never
# Dependencies first, as their own layer: they change far less often than the
# source, so editing a .py file doesn't reinstall osmium (which is slow).
# --no-install-project because the project itself isn't copied yet.
COPY pyproject.toml uv.lock ./
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-install-project --no-dev
COPY src/ ./src/
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-dev
ENV PATH="/app/.venv/bin:$PATH"
# data/ (the OSM extract, transit stops, feature grid) is bind-mounted at run
# time, not baked in: it's ~40MB of generated artefacts that change on a map
# refresh, not on a code change. See docker-compose.yml.
EXPOSE 8000
# 0.0.0.0 rather than 127.0.0.1: inside a container, binding to loopback makes
# the published port unreachable from the host. Same trap as GraphHopper's
# bind_host — see graphhopper/config.yml.
CMD ["uvicorn", "run_planner.main:app", "--host", "0.0.0.0", "--port", "8000"]