qrit-api / Dockerfile
samdak93's picture
chnage dockerfile
9240df3
raw
history blame contribute delete
861 Bytes
# Use an official Python runtime
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user to run the app
RUN useradd -m appuser
# Create the cache directory and set proper permissions
RUN mkdir -p /app/cache && \
chown -R appuser:appuser /app
# Copy app code
COPY app.py /app/app.py
COPY requirements.txt /app/requirements.txt
# Install Python dependencies
RUN pip install --upgrade pip && pip install -r requirements.txt
# Set environment variables for the model caching
ENV TRANSFORMERS_CACHE=/app/cache
ENV HF_HOME=/app/cache
# Switch to non-root user
USER appuser
# Expose the port
EXPOSE 7860
# Start the Flask app
CMD ["python", "app.py"]