Spaces:
Sleeping
Sleeping
File size: 1,125 Bytes
ce47c87 47db460 ce47c87 8e1fc1a ce47c87 020ff75 e9cb74e d0232d6 ce47c87 01a7a71 ce47c87 020ff75 |
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 |
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Copy the requirements file
COPY requirements.txt .
# Install any needed packages specified in requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir torch
RUN pip install --no-cache-dir --upgrade transformers
# Install supervisor to manage multiple processes
RUN apt-get update && apt-get install -y supervisor \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy the application code
COPY . .
RUN chmod +x /app/start.sh
# Create a cache directory that is writable
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
# Set the HF_HOME environment variable
ENV HF_HOME=/app/cache
# Expose the necessary ports
EXPOSE 7860 8502
# Create a supervisor configuration file
RUN mkdir -p /etc/supervisor/conf.d/
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Command to start supervisor
# CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
CMD ["/app/start.sh"]
|