File size: 911 Bytes
c0e2fd2 | 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 | # Alternative Dockerfile using Ubuntu base
FROM ubuntu:20.04
# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install Python and system dependencies
RUN apt-get update && apt-get install -y \
python3.9 \
python3.9-dev \
python3.9-distutils \
python3-pip \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Create symlink for python command
RUN ln -s /usr/bin/python3.9 /usr/bin/python
# Set working directory
WORKDIR /app
# Copy and install dependencies
COPY requirements.txt .
RUN pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir -r requirements.txt
# Copy project files
COPY . .
# Expose Hugging Face Space port
EXPOSE 7860
# Start FastAPI server
CMD ["python", "-m", "uvicorn", "inference_server:app", "--host", "0.0.0.0", "--port", "7860"]
|