File size: 743 Bytes
81fe8c1
 
1bef953
 
81fe8c1
1bef953
 
81fe8c1
1bef953
 
 
81fe8c1
1bef953
 
81fe8c1
1bef953
 
 
 
81fe8c1
 
1bef953
81fe8c1
 
1bef953
81fe8c1
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
FROM pytorch/pytorch:2.0.0-cuda11.7-cudnn8-runtime

# Create a new user with user ID 1000
RUN useradd -m -u 1000 user

# Set environment variables for cache
ENV HF_HOME=/home/user/cache

# Set the working directory and switch to the new user
USER user
WORKDIR /home/user/app

# Create the cache directory with correct ownership and permissions
RUN mkdir -p /home/user/cache && chmod -R 777 /home/user/cache

# Copy application files with ownership set to the new user
COPY --chown=user . /home/user/app

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Expose the application port
EXPOSE 7860

# Run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]