##### PostgresQL migrations using Sqitch #####

# https://github.com/debuerreotype/docker-debian-artifacts/issues/134
FROM debian:bullseye-slim

# Install Sqitch, Postgres app_client, and nc (for entrypoint)
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
    && DEBIAN_FRONTEND=noninteractive \
    apt-get install -y --no-install-recommends \
    sqitch \
    libpq5 \
    netcat

RUN mkdir sqitch
WORKDIR sqitch

COPY . .

ENV POSTGRES_HOST POSTGRES_DB POSTGRES_PASSWORD POSTGRES_PORT POSTGRES_USER

ENTRYPOINT ["./entrypoint.sh"]
