tracksolid_timescale_grafan.../Dockerfile
David Kiania 326764e1a0 Fix migration failures: switch to full TimescaleDB + use psql runner
- Change image from timescaledb-ha:pg16-ts2.15-oss to pg16-ts2.15
  (OSS edition lacks compression, retention, continuous aggregates)
- Add postgresql-client to Dockerfile for psql binary
- Rewrite run_migrations.py to use psql instead of psycopg2
  (psql runs each statement independently; psycopg2 wraps the
  entire file in one transaction so one error rolls back everything)
- Add schema verification: exits 1 if critical tables missing,
  preventing services from starting with broken schema

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 17:17:58 +03:00

31 lines
No EOL
817 B
Docker

# Use a slim Python image
FROM python:3.12-slim
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
# Install system dependencies (Required for Postgres and Healthchecks)
RUN apt-get update && apt-get install -y \
libpq5 \
postgresql-client \
curl \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy dependency files
COPY pyproject.toml .
# COPY uv.lock . # Uncomment this once you have generated a lockfile locally
# Install dependencies into a system-wide environment
RUN uv pip install --system -r pyproject.toml
# Copy the rest of the application
COPY . .
# Security: Run as a non-privileged user (standard for 24/7 telemetry)
RUN useradd -m telemetry-user
USER telemetry-user
# CMD is handled by docker-compose.yml to differentiate movement vs events