From fe88dfa599f1c2ab65a842177eff37f395625fca Mon Sep 17 00:00:00 2001 From: James Bristow Date: Fri, 11 Nov 2022 19:18:44 +1300 Subject: [PATCH] Adding MLFlow --- .env | 13 +++++++++++++ .gitignore | 1 - Dockerfile | 12 ++++++++++++ README.md | 1 + docker-compose.yaml | 12 ++++++++++++ docker_build.sh | 8 ++++++++ docker_push.sh | 13 +++++++++++++ 7 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 .env create mode 100644 Dockerfile create mode 100644 docker-compose.yaml create mode 100644 docker_build.sh create mode 100644 docker_push.sh diff --git a/.env b/.env new file mode 100644 index 0000000..364f595 --- /dev/null +++ b/.env @@ -0,0 +1,13 @@ +# Conda +CONDA_TAG=4.12.0 + +# MLFlow +MLFLOW_LABEL=1.30.0 + +# Psycopg +PSYCOPG_LABEL=2.9.3 + +# Docker +CONTAINER_REG_USER=jbris +CONTAINER_REG_NAME=mlflow-docker + \ No newline at end of file diff --git a/.gitignore b/.gitignore index b6e4761..0c9c949 100644 --- a/.gitignore +++ b/.gitignore @@ -102,7 +102,6 @@ celerybeat.pid *.sage.py # Environments -.env .venv env/ venv/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d9ca0ea --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +ARG CONDA_TAG + +FROM continuumio/miniconda3:${CONDA_TAG} + +RUN mkdir -p /mlflow/mlruns + +WORKDIR /mlflow + +ARG MLFLOW_LABEL +ARG PSYCOPG_LABEL + +RUN conda install -c conda-forge psycopg2=${PSYCOPG_LABEL} mlflow=${MLFLOW_LABEL} -y --quiet diff --git a/README.md b/README.md index 39f3798..169292f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # mlflow-docker + Run MLFlow through Docker diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..53bf3ae --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,12 @@ +version: "3.7" + +services: + + mlflow: + image: "continuumio/miniconda3:${CONDA_TAG}" + build: + context: . + args: + CONDA_TAG: $CONDA_TAG + MLFLOW_LABEL: $MLFLOW_LABEL + PSYCOPG_LABEL: $PSYCOPG_LABEL diff --git a/docker_build.sh b/docker_build.sh new file mode 100644 index 0000000..1fc7ea7 --- /dev/null +++ b/docker_build.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +################################################################### +# Main +################################################################### + +docker compose pull +docker compose build diff --git a/docker_push.sh b/docker_push.sh new file mode 100644 index 0000000..43740fc --- /dev/null +++ b/docker_push.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +. .env + +################################################################### +# Main +################################################################### + +echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin + +# To find DOCKER_IMAGE_HASH: docker image ls +docker tag "$DOCKER_IMAGE_HASH" "ghcr.io/${CONTAINER_REG_USER}/${CONTAINER_REG_NAME}:latest" +docker push "ghcr.io/${CONTAINER_REG_USER}/${CONTAINER_REG_NAME}:latest"