7c23c3f4c7
- Telegram-Bot (Polling) mit Inline-Menue: Klarbild x2/x4, Freistellen, kombiniert - Upscaling via OpenCV dnn_superres (FSRCNN default, EDSR optional), gekachelt - Freistellen via rembg (isnet-general-use, Alpha-Matting) - Picdrop-Batch via SFTP (/picdrop) - Health-Server (aiohttp) fuer Coolify, Zugriffsschutz via ALLOWED_USER_IDS - Dockerfile backt Modelle (SR von raw.githubusercontent, rembg von HF-Mirror) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XNQ8ghPfzAfsyVYd6HgFb6
39 lines
1.3 KiB
Docker
39 lines
1.3 KiB
Docker
FROM python:3.11-slim
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
MODELS_DIR=/app/models \
|
|
U2NET_HOME=/app/models/u2net \
|
|
WORK_DIR=/tmp/klarbild \
|
|
PORT=8080
|
|
|
|
WORKDIR /app
|
|
|
|
# System-Abhaengigkeiten (OpenMP fuer onnxruntime/opencv, curl fuer Modelle)
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl ca-certificates libgomp1 libglib2.0-0 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install -r requirements.txt
|
|
|
|
# Super-Resolution-Modelle (EDSR/FSRCNN) beim Build backen
|
|
COPY scripts/ scripts/
|
|
RUN bash scripts/fetch_models.sh /app/models
|
|
|
|
# Freistell-Modell (rembg isnet-general-use) vom HuggingFace-Mirror vorladen,
|
|
# damit zur Laufzeit kein externer Download noetig ist
|
|
RUN mkdir -p /app/models/u2net && \
|
|
curl -fL --retry 3 -o /app/models/u2net/isnet-general-use.onnx \
|
|
"https://huggingface.co/tomjackson2023/rembg/resolve/main/isnet-general-use.onnx"
|
|
|
|
COPY app/ app/
|
|
|
|
EXPOSE 8080
|
|
|
|
# Simpler HTTP-Healthcheck (Health-Server laeuft im Bot-Prozess)
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=40s --retries=3 \
|
|
CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8080/health',timeout=3).status==200 else 1)"
|
|
|
|
CMD ["python", "-m", "app.bot"]
|