# Build from a LINUX lightweight version of Anaconda FROM continuumio/miniconda3 # Update packages and install necessary utilities RUN apt-get update && apt-get install -y \ nano unzip curl gnupg software-properties-common # Install gcloud CLI (Google Cloud SDK) RUN curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg \ && echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \ && apt-get update && apt-get install -y google-cloud-sdk # Create a non-root user (Hugging Face requirement) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Copy files with correct ownership for Hugging Face COPY --chown=user . $HOME/app # Copy and install dependencies COPY requirements.txt /requirements.txt RUN pip install -r /requirements.txt # Set GCP project and other environment variables # Note: These should be passed as build arguments or environment variables when running the container. # It's NOT recommended to hardcode sensitive information in the Dockerfile. ARG GCP_PROJECT ENV GCP_PROJECT=$GCP_PROJECT ENV BACKEND_STORE_URI=$BACKEND_STORE_URI ENV ARTIFACT_STORE_URI=$ARTIFACT_STORE_URI # Launch mlflow server CMD mlflow server -p $PORT \ --host 0.0.0.0 \ --backend-store-uri $BACKEND_STORE_URI \ --default-artifact-root $ARTIFACT_STORE_URI