ARG PYTHON_VERSION=3.13

########################
# Resources repository #
########################
FROM alpine/git AS eppd
RUN git clone https://gitlab.nic.cz/fred/mod-eppd.git /mod-eppd/

###############
# Final image #
###############
FROM python:${PYTHON_VERSION}-slim

RUN adduser --home /app --disabled-password --comment eppic eppic
WORKDIR /app

COPY --from=eppd /mod-eppd/schemas /app/schemas
COPY --from=eppd --chown=eppic:eppic /mod-eppd/ssl/test-cert.pem /mod-eppd/ssl/test-key.pem /app/

COPY --from=config entrypoint.sh /app
COPY --from=config eppic.conf /etc/eppic/eppic.conf

USER eppic

ENV PATH="/app/venv/bin:${PATH}"

COPY . /app
RUN python3 -m venv /app/venv && pip install --index-url=https://pypi.nic.cz/cznic/public --no-cache-dir /app

ENTRYPOINT ["/app/entrypoint.sh"]
