Spaces:
Paused
Paused
| # Use Python base image | |
| FROM python:3.9 | |
| # Set environment variables | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| PYTHONUNBUFFERED=1 \ | |
| SHELL=/bin/bash \ | |
| TZ=Europe/Paris | |
| # Install some basic utilities | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| wget \ | |
| curl \ | |
| git \ | |
| sudo \ | |
| procps \ | |
| git-lfs \ | |
| zip \ | |
| unzip \ | |
| htop \ | |
| vim \ | |
| nano \ | |
| bzip2 \ | |
| build-essential \ | |
| libsndfile-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a non-root user and switch to it | |
| RUN adduser --disabled-password --gecos '' --shell /bin/bash user \ | |
| && chown -R user:user /app | |
| RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user | |
| USER user | |
| # All users can use /home/user as their home directory | |
| ENV HOME=/home/user | |
| RUN mkdir -p $HOME/.cache $HOME/.config /data \ | |
| && chmod -R 777 $HOME /data | |
| # Set the working directory to /app | |
| WORKDIR /app | |
| # Copy requirements.txt and install dependencies as the non-root user | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the start_server.sh script and make it executable | |
| COPY --chown=user start_server.sh . | |
| RUN chmod +x start_server.sh | |
| # Expose the MLflow port | |
| EXPOSE 7860 | |
| # Start the MLflow server using the start_server.sh script | |
| CMD ["./start_server.sh"] | |