Spaces:
Sleeping
Sleeping
File size: 1,262 Bytes
364b7d1 da59cbe 364b7d1 da59cbe 364b7d1 27b79c7 d11d533 364b7d1 da59cbe 364b7d1 93209fd 364b7d1 93209fd 364b7d1 93209fd da59cbe 364b7d1 |
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 34 35 36 37 38 |
# Use an official Python runtime as a parent image
FROM ubuntu:22.04
# Install system dependencies required for Python and Git LFS
RUN apt-get update && \
apt-get install -y curl git python3 python3-pip && \
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
apt-get install -y git-lfs
# Set up a user to avoid running as root
RUN useradd -m -u 1000 user && \
mkdir -p /home/user/app /home/user/.cache/huggingface/hub /home/user/.config/matplotlib && \
chown -R user:user /home/user
# Set environment variables
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
MPLCONFIGDIR=/home/user/.config/matplotlib \
TRANSFORMERS_CACHE=/home/user/.cache/huggingface/hub
# Set the working directory in the container
WORKDIR $HOME/app
# Copy the current directory contents into the container at $HOME/app
COPY --chown=user:user . .
# Install Python dependencies
RUN python3 -m pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Clone the necessary Git repository
RUN git lfs install && \
git clone https://huggingface.co/AskUI/pta-text-0.1 $HOME/app/model
# Run app.py when the container launches
CMD ["python3", "app.py"] |