-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (50 loc) · 2.14 KB
/
Copy pathDockerfile
File metadata and controls
67 lines (50 loc) · 2.14 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# syntax=docker/dockerfile:1.4
# ---- Build stage: resolve + install deps with uv into /app/.venv ----
FROM python:3.14-slim AS builder
# uv: fast, reproducible installs from uv.lock. Pinned for deterministic,
# supply-chain-safe builds (Dependabot's docker ecosystem keeps it current).
COPY --from=ghcr.io/astral-sh/uv:0.11.16 /uv /uvx /bin/
ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy
WORKDIR /app
# Install dependencies first (cached layer keyed on the lockfile)
COPY pyproject.toml uv.lock ./
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-install-project --no-dev
# Install the project itself
COPY . .
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev
# ---- Runtime stage ----
FROM python:3.14-slim
LABEL org.opencontainers.image.title="TeslaOnTarget" \
org.opencontainers.image.description="Bridge Tesla vehicles with TAK servers for real-time position tracking" \
org.opencontainers.image.authors="Joshua Fuller" \
org.opencontainers.image.source="https://github.com/joshuafuller/TeslaOnTarget" \
org.opencontainers.image.licenses="MIT"
# Non-root runtime user
RUN useradd -m -s /bin/bash -u 1000 teslauser && \
mkdir -p /data /logs /app && \
chown -R teslauser:teslauser /data /logs /app
WORKDIR /app
# Copy the fully-provisioned app (source + /app/.venv) from the builder
COPY --from=builder --chown=teslauser:teslauser /app /app
# Put the venv on PATH so `python`/`python3` resolve to it, and point the config
# loader at an explicit path so it never depends on the package install layout.
ENV PATH="/app/.venv/bin:$PATH" \
TESLAONTARGET_CONFIG="/app/config.py" \
TESLA_USERNAME="" \
TAK_SERVER="" \
TAK_PORT="8085" \
API_LOOP_DELAY="10" \
DEAD_RECKONING_ENABLED="True" \
DEAD_RECKONING_DELAY="1" \
DEBUG_MODE="False" \
VEHICLE_FILTER=""
RUN cp /app/docker-entrypoint.sh / && chmod +x /docker-entrypoint.sh
USER teslauser
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD ["python", "-c", "import teslaontarget; print('healthy')"]
VOLUME ["/data", "/logs"]
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["run"]