Spaces:
Sleeping
Sleeping
# 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"] | |