Spaces:
Sleeping
Sleeping
File size: 1,137 Bytes
c914f37 4786618 c914f37 0fbe1a9 c914f37 4786618 c914f37 4786618 967a5fb 0fbe1a9 4786618 c914f37 0fbe1a9 967a5fb |
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 |
FROM python:3.10-slim
# Create app user
RUN useradd -m -u 1000 user
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY requirements-full.txt .
RUN pip install --no-cache-dir -r requirements-full.txt
# Download required NLTK data
RUN python -m nltk.downloader -d /usr/local/share/nltk_data punkt stopwords
# Create cache directories with proper permissions
RUN mkdir -p /app/.cache && chown -R user:user /app/.cache
# Copy application code
COPY --chown=user:user app/ ./app/
COPY --chown=user:user main.py .
COPY --chown=user:user main_simple.py .
COPY --chown=user:user main_full.py .
COPY --chown=user:user main_vercel.py .
# Switch to user
USER user
# Set environment variables
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
ENV HF_HOME=/app/.cache/huggingface
ENV PYTHONUNBUFFERED=1
# Expose port
EXPOSE 7860
# Run the application (using full version with all ML capabilities)
CMD ["uvicorn", "main_full:app", "--host", "0.0.0.0", "--port", "7860"] |