imgtools-ai / Dockerfile
ilhamdev's picture
feat: add new dependencies for image processing and formats
0db733a
Raw History Blame Contribute Delete
896 Bytes
FROM python:3.11-slim
# Instal dependensi sistem yang dibutuhkan untuk OpenCV/Pillow/curl
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Buat user non-root dengan UID 1000 untuk kompatibilitas Hugging Face Spaces
RUN useradd -m -u 1000 user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Salin dependensi dan pasang dengan pip
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Salin seluruh kode aplikasi
COPY --chown=user:user . .
USER user
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--timeout-keep-alive", "75"]