File size: 629 Bytes
a08c526
c86e8d2
a08c526
c86e8d2
cc2fe49
 
 
 
 
 
 
 
 
c86e8d2
cc2fe49
 
 
c86e8d2
cc2fe49
 
 
c86e8d2
725dfbf
 
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
FROM python:3.9-slim

WORKDIR /app

# Copy and install requirements
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt

# Set up a new non-root user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH

# Create a cache directory and set environment variable
RUN mkdir -p /home/user/.cache && chown -R user:user /home/user/.cache
ENV HF_HOME=/home/user/.cache

# Set working directory to the user's app directory
WORKDIR $HOME/app
COPY --chown=user . $HOME/app

EXPOSE 7860
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]