matsuap's picture
Upload folder using huggingface_hub
aac61fa verified
FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
ffmpeg \
poppler-utils \
libvips-dev \
curl \
git \
unixodbc \
unixodbc-dev \
gnupg2 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install Microsoft ODBC Driver for SQL Server (Modern method)
RUN curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg \
&& curl -fsSL https://packages.microsoft.com/config/debian/12/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql18 \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /code
# Copy requirements file first for better caching
COPY requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Create a non-root user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Copy the application code
COPY --chown=user . $HOME/app
# Fix permissions
RUN mkdir -p $HOME/app/assets && chmod 777 $HOME/app/assets
EXPOSE 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]