Skip to content

Instantly share code, notes, and snippets.

@AahanSingh
Last active October 20, 2021 07:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save AahanSingh/67c9bacc0336445d79789c73b0ae650a to your computer and use it in GitHub Desktop.
MLFlow Dockerfile
FROM python:3.6
RUN apt update && apt install -y python3-venv gcc
RUN apt-get install -y python3-dev build-essential
ENV VENV=/.venv/myenv
RUN python3 -m venv ${VENV}
RUN mkdir -p $VENV/src
ENV PATH=$VENV/bin:$PATH
RUN pip install -U pip
RUN pip install psycopg2 mlflow google-cloud google-cloud-storage
# Mount the credentials json file under the following directory
RUN mkdir -p /workdir/gcloud-credentials/
WORKDIR /workdir/
RUN curl https://sdk.cloud.google.com > install.sh
RUN bash install.sh --disable-prompts --install-dir=/workdir/
# Make sure your credentials file is named gcloud-credentials.json too
ENV GOOGLE_APPLICATION_CREDENTIALS=/workdir/gcloud-credentials/gcloud-credentials.json
ENV PATH=/workdir/google-cloud-sdk/bin:$PATH
# Expose the port that the MLFlow tracking server runs on
EXPOSE 5000
# Default database credentials
ENV DB_USERNAME=admin
ENV DB_PASSWORD=password
ENV DB_URL=mlflow-database:5432
ENV DB_NAME=mlflow-tracking-server-db
ENTRYPOINT gcloud auth activate-service-account --key-file=/workdir/gcloud-credentials/gcloud-credentials.json && \
mlflow server \
--default-artifact-root $ARTIFACT_STORE \
--backend-store-uri postgresql://$DB_USERNAME:$DB_PASSWORD@$DB_URL/$DB_NAME --host 0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment