# Copyright (c) 2025 Martin Kayser (tebarius)
# Licensed under the MIT License. See LICENSE file in the project root.
FROM python:3.14-slim
LABEL authors="tebarius"
LABEL description="tebarius Mysteryhelfer web"

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1


RUN apt-get update \
    && apt-get install -y --no-install-recommends curl \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY requirements.txt .

RUN python -m pip install --upgrade pip \
    && pip install --no-cache-dir -r requirements.txt

COPY ./app /app
# ein bisschen Patchen um auch beim Bookmarken oder Versenden der Webadresse per Messenger den richtigen Titel und das
# richtige Favicon zu verwenden/sehen
COPY ./app/images/favicon.ico /usr/local/lib/python3.14/site-packages/streamlit/static/favicon.ico
RUN sed -i -e 's|favicon\.png|favicon.ico|' \
        -e 's|<title>.*</title>|<title>tebarius Mysteryhelfer (web)</title>|' \
        /usr/local/lib/python3.14/site-packages/streamlit/static/index.html \
    && useradd -m -u 1000 myst \
    && chown -R myst:myst /app
USER myst

EXPOSE 8501

HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

ENTRYPOINT ["/bin/bash", "entrypoint.sh"]
