File size: 887 Bytes
6af7294
 
 
d3309bd
 
6af7294
 
 
 
d3309bd
 
 
 
 
 
 
da6adc0
 
 
d3309bd
da6adc0
d3309bd
6af7294
 
408eda8
6af7294
 
 
 
 
a640928
 
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
# 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