Spaces:
Running
Running
File size: 2,132 Bytes
045c49f 8e88427 f36ab8c 8e88427 fdbd75e 8e88427 fdbd75e 8e88427 4dd7daf 8e88427 fdbd75e af3fb06 f36ab8c b1785e8 8e88427 b1785e8 8e88427 f17e7be b1785e8 f17e7be b1785e8 8e88427 b1785e8 8e88427 b1785e8 8e88427 045c49f f36ab8c b1785e8 f36ab8c 8e88427 045c49f b1785e8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | # HuggingFace Spaces Dockerfile - Bot + API Only
# Dashboard is deployed separately on Vercel
FROM ubuntu:22.04
# Set timezone
ENV TZ=Asia/Kolkata
ENV DEBIAN_FRONTEND=noninteractive
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install Python 3.11 and required system packages
RUN apt-get update && apt-get install -y --no-install-recommends \
software-properties-common \
ca-certificates \
gnupg2 \
gdb \
git \
gcc \
g++ \
make \
ffmpeg \
mediainfo \
curl \
wget \
tesseract-ocr\
neofetch \
dnsutils \
bash \
&& mkdir -p /usr/share/keyrings \
&& curl -fsSL https://keyserver.ubuntu.com/pks/lookup?op=get\&search=0xF23C5A6CF475977595C89F51BA6932366A755776 | gpg --dearmor -o /usr/share/keyrings/deadsnakes.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/deadsnakes.gpg] http://ppa.launchpad.net/deadsnakes/ppa/ubuntu jammy main" > /etc/apt/sources.list.d/deadsnakes-ppa.list \
&& apt-get update && apt-get install -y --no-install-recommends \
python3.11 \
python3.11-dev \
python3.11-venv \
python3.11-distutils \
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd -m user
# Set working directory
WORKDIR /app
# Upgrade pip and install base packages
ENV PIP_ROOT_USER_ACTION=ignore
RUN pip install --upgrade pip
RUN pip install --no-cache-dir uvicorn fastapi httpx
# Copy startup scripts
COPY startup-hf-init.sh /app/startup-hf-init.sh
COPY start_hf.py /app/start_hf.py
RUN chmod +x /app/startup-hf-init.sh
# Set environment
ENV PYTHONPATH="${PYTHONPATH}:/app/repo"
ENV PATH="/home/user/.local/bin:$PATH"
# Expose HuggingFace port (mandatory)
EXPOSE 7860
ENV PORT=7860
# Change ownership
RUN chown -R user:user /app
# Switch to non-root user
USER user
# Run initialization script (clones repo, starts bot + API)
CMD ["/app/startup-hf-init.sh"]
|