Spaces:
Sleeping
Sleeping
# Use an official CUDA runtime as a parent image | |
FROM nvidia/cuda:11.2.2-runtime-ubuntu20.04 | |
# Copy the current directory contents into the container at /usr/src/app | |
WORKDIR $HOME/app | |
# Install Python | |
RUN apt-get update && apt-get install -y python3.8 python3-pip | |
RUN useradd -m -u 1000 user | |
# Switch to the "user" user | |
USER user | |
# Set home to the user's home directory | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
# Set the cache directories to a path with write access | |
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache | |
ENV MPLCONFIGDIR=/tmp/matplotlib | |
ENV HF_HOME=/tmp/huggingface_cache | |
COPY --chown=user . $HOME/app | |
# Install any needed packages specified in requirements.txt | |
RUN pip3 install -r $HOME/app/requirements.txt | |
# Make port 80 available to the world outside this container | |
EXPOSE 7860 | |
# Run app.py when the container launches | |
CMD python3 $HOME/app/app.py | |