ai_one_server_2 / Dockerfile
sourav520's picture
Upload 4 files
a913f61 verified
Raw
History Blame Contribute Delete
752 Bytes
FROM python:3.10-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Non-root user required by Hugging Face Spaces
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR /home/user/app
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
COPY --chown=user main.py .
COPY --chown=user u2net.onnx .
RUN mkdir -p uploads outputs
EXPOSE 7860
ENV PYTHONUNBUFFERED=1
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
CMD ["python", "main.py"]