Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

1.3 KB
Raw Blame
# Migration container for running Rust-based database migrations
# Supports persons, behavioral cohorts, cyclotron migrations
FROM rust:1.91-bookworm AS builder

RUN cargo install sqlx-cli --version 0.8.0 --features native-tls,postgres --no-default-features --locked

FROM debian:bookworm-slim

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    ca-certificates \
    libpq5 \
    postgresql-client \
    libssl3 \
    && rm -rf /var/lib/apt/lists/*

COPY --from=builder /usr/local/cargo/bin/sqlx /usr/local/bin/sqlx

WORKDIR /migrations

COPY ./persons_migrations ./persons_migrations
COPY ./behavioral_cohorts_migrations ./behavioral_cohorts_migrations
COPY ./cyclotron-node-migrations ./cyclotron-node-migrations
COPY ./flags_read_store_migrations ./flags_read_store_migrations

COPY ./bin/migrate-persons ./bin/migrate-persons
COPY ./bin/migrate-cyclotron-node ./bin/migrate-cyclotron-node
COPY ./bin/migrate-behavioral-cohorts ./bin/migrate-behavioral-cohorts
COPY ./bin/migrate-entry ./bin/migrate-entry

RUN chmod +x /migrations/bin/migrate-entry && \
    chmod +x /migrations/bin/migrate-persons && \
    chmod +x /migrations/bin/migrate-cyclotron-node && \
    chmod +x /migrations/bin/migrate-behavioral-cohorts

ENTRYPOINT ["/migrations/bin/migrate-entry"]