| # Use the official Python base image | |
| FROM python:3.10 | |
| # Install Git LFS | |
| RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash | |
| RUN apt-get -o Acquire::AllowInsecureRepositories=true update && apt-get install -y git-lfs | |
| #RUN apt-get update && apt-get install -y git-lfs | |
| # /static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpermission-denied-for-writing-files-within-spaces%2F29799%3C%2Fspan%3E%3C!-- HTML_TAG_END --> | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Set the working directory | |
| WORKDIR $HOME/app | |
| # Copy requirements.txt into the container | |
| COPY requirements.txt . | |
| # Install the required packages | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Set the git credential helper to "store" | |
| RUN git config --global credential.helper store | |
| # Copy the rest of the application files into the container | |
| COPY . . | |
| # Copy supervisord.conf into the container | |
| COPY supervisord.conf . | |
| # Set permissions on the log file | |
| USER root | |
| RUN touch $HOME/app/mylog.log $HOME/app/supervisord.log && chmod a+rwx $HOME/app/mylog.log $HOME/app/supervisord.log | |
| USER user | |
| # RUN mkdir -m 777 -p /.cache/huggingface/hub/ | |
| # Expose the desired port | |
| EXPOSE 7860 | |
| # Run supervisord | |
| CMD ["supervisord", "-c", "supervisord.conf"] |