ccy2026/OutLookEmailPlus-Manager
0
1ARG IMAGE_REF=ghcr.io/zeropointsix/outlook-email-plus:latest2FROM ${IMAGE_REF}3 4ENV PYTHONDONTWRITEBYTECODE=1 \5 PYTHONUNBUFFERED=1 \6 PIP_NO_CACHE_DIR=1 \7 PIP_DISABLE_PIP_VERSION_CHECK=1 \8 DEBIAN_FRONTEND=noninteractive \9 APP_SOURCE=image \10 APP_IMAGE_DIR=/app \11 APP_GIT_DIR=/workspace/app-git \12 DATA_DIR=/data \13 DATABASE_PATH=/data/outlook_accounts.db \14 PORT=5000 \15 GUNICORN_TIMEOUT=300 \16 GUNICORN_THREADS=417 18WORKDIR /workspace19 20ARG GIT_REPO=https://github.com/ZeroPointSix/outlookEmailPlus.git21 22RUN apt-get update \23 && apt-get install -y --no-install-recommends git ca-certificates bash \24 && rm -rf /var/lib/apt/lists/*25 26RUN git clone --depth 1 "$GIT_REPO" "$APP_GIT_DIR" \27 && pip install --upgrade pip \28 && pip install -r "$APP_GIT_DIR/requirements.txt" \29 && pip install gunicorn30 31RUN mkdir -p /data \32 && cat <<'EOF' > /usr/local/bin/start-hf-space.sh33#!/usr/bin/env bash34set -euo pipefail35 36APP_SOURCE="${APP_SOURCE:-image}"37APP_IMAGE_DIR="${APP_IMAGE_DIR:-/app}"38APP_GIT_DIR="${APP_GIT_DIR:-/workspace/app-git}"39DATA_DIR="${DATA_DIR:-/data}"40PORT="${PORT:-5000}"41 42if [ "$APP_SOURCE" = "git" ]; then43 APP_DIR="$APP_GIT_DIR"44else45 APP_DIR="$APP_IMAGE_DIR"46fi47 48if [ ! -f "$APP_DIR/web_outlook_app.py" ]; then49 echo "[hf-space] app entrypoint not found in $APP_DIR" >&250 exit 151fi52 53mkdir -p "$DATA_DIR"54 55export DATA_DIR56export DATABASE_PATH="${DATABASE_PATH:-$DATA_DIR/outlook_accounts.db}"57export HOST="0.0.0.0"58export PORT59 60cd "$APP_DIR"61exec gunicorn -k gthread -w 1 --threads "${GUNICORN_THREADS:-4}" \62 -b "0.0.0.0:${PORT}" \63 --timeout "${GUNICORN_TIMEOUT:-300}" \64 --graceful-timeout 30 \65 --access-logfile - \66 --error-logfile - \67 --capture-output \68 web_outlook_app:app69EOF70 71RUN chmod +x /usr/local/bin/start-hf-space.sh72 73EXPOSE 500074 75CMD ["/usr/local/bin/start-hf-space.sh"]76 