# GNU Taler merchant backend
#
# Installation follows the Merchant Backend Operator Manual:
# https://docs.taler.net/taler-merchant-manual.html#installing-the-gnu-taler-binary-packages-on-debian
#
# The packages are built for Debian trixie, so that is the base image.
FROM debian:trixie-slim

ENV DEBIAN_FRONTEND=noninteractive

# Tools needed to import the Taler Systems SA signing key
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        ca-certificates \
        wget \
    && rm -rf /var/lib/apt/lists/*

# Import the Taler Systems SA public package signing key
RUN mkdir -p /etc/apt/keyrings \
    && wget -O /etc/apt/keyrings/taler-systems.gpg \
        https://taler.net/taler-systems.gpg

# Add the GNU Taler package repository and install the merchant backend
RUN echo "deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] https://deb.taler.net/apt/debian trixie main" \
        > /etc/apt/sources.list.d/taler.list \
    && apt-get update \
    && apt-get install -y --no-install-recommends \
        postgresql-client \
        taler-merchant \
    && rm -rf /var/lib/apt/lists/*

COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod 0755 /usr/local/bin/entrypoint.sh

# Default TCP port of taler-merchant-httpd (see [merchant]/PORT)
EXPOSE 9966

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
