Spaces:
Runtime error
Runtime error
| # 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"] |