-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dagster and mlflow docker images (#3)
* feat: Add dagster Dockerfile. Adjust project structure * ci: Add dagster image build step * feat: Add mlflow Dockerfile. Adjust jupyter and dagster Dockerfile * ci: Add mlflow Docker image build step * ci: fix invalid value `contest` * ci: Make ids unique * feat: Add ´torch` and `torchvision` to jupyter image * feat: Add seaborn as dependency
- Loading branch information
Showing
10 changed files
with
1,645 additions
and
1,045 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[formats] | ||
"dagster/" = "ipynb" | ||
"dagster/scripts/" = "py:percent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Based on https://gist.githubusercontent.com/usr-ein/c42d98abca3cb4632ab0c2c6aff8c88a/raw/19dcc899f68d0b08c2c137d3fd01715b0c84bac9/Dockerfile | ||
|
||
################################ | ||
# PYTHON-BASE | ||
# Sets up all our shared environment variables | ||
################################ | ||
FROM --platform=$TARGETPLATFORM python:3.11-slim as python-base | ||
|
||
ARG TARGETPLATFORM | ||
|
||
# python | ||
ENV PYTHONUNBUFFERED=1 \ | ||
# prevents python creating .pyc files | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
\ | ||
# pip | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
\ | ||
# poetry | ||
# https://python-poetry.org/docs/configuration/#using-environment-variables | ||
POETRY_VERSION=1.6.1 \ | ||
# make poetry install to this location | ||
POETRY_HOME="/opt/poetry" \ | ||
# make poetry create the virtual environment in the project's root | ||
# it gets named `.venv` | ||
POETRY_VIRTUALENVS_IN_PROJECT=true \ | ||
# do not ask any interactive question | ||
POETRY_NO_INTERACTION=1 \ | ||
\ | ||
# paths | ||
# this is where our requirements + virtual environment will live | ||
PYSETUP_PATH="/opt/pysetup" \ | ||
VENV_PATH="/opt/pysetup/.venv" | ||
|
||
|
||
# prepend poetry and venv to path | ||
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH" | ||
|
||
|
||
################################ | ||
# BUILDER-BASE | ||
# Used to build deps + create our virtual environment | ||
################################ | ||
FROM python-base as builder-base | ||
RUN apt-get update \ | ||
&& apt-get install --no-install-recommends -y \ | ||
# deps for installing poetry | ||
curl \ | ||
# deps for building python deps | ||
build-essential | ||
|
||
# install poetry - respects $POETRY_VERSION & $POETRY_HOME | ||
# The --mount will mount the buildx cache directory to where | ||
# Poetry and Pip store their cache so that they can re-use it | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
# copy project requirement files here to ensure they will be cached. | ||
WORKDIR $PYSETUP_PATH | ||
COPY ../../poetry.lock pyproject.toml ./ | ||
|
||
# install runtime deps - uses $POETRY_VIRTUALENVS_IN_PROJECT internally | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
poetry install --with dagster-webserver,dagster --without mlflow | ||
|
||
|
||
################################ | ||
# PRODUCTION | ||
# Final image used for runtime | ||
################################ | ||
FROM python-base as production | ||
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH | ||
|
||
RUN mkdir -p /opt/dagster/dagster_home /opt/dagster/app | ||
|
||
ENV DAGSTER_HOME=/opt/dagster/dagster_home/ | ||
|
||
# Copy your workspace to /opt/dagster/app | ||
|
||
COPY ./docker/dagster/workspace.yaml /opt/dagster/app/ | ||
COPY ./docker/dagster/dagster.yaml $DAGSTER_HOME/ | ||
|
||
|
||
WORKDIR /opt/dagster/app | ||
EXPOSE 3000 | ||
ENV SHELL="/bin/bash" | ||
|
||
ENTRYPOINT ["dagster","dev","-h","0.0.0.0","-p","3000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
telemetry: | ||
enabled: False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# workspace.yaml | ||
|
||
load_from: | ||
- python_file: /opt/dagster/code/dagster-demo.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Based on https://gist.githubusercontent.com/usr-ein/c42d98abca3cb4632ab0c2c6aff8c88a/raw/19dcc899f68d0b08c2c137d3fd01715b0c84bac9/Dockerfile | ||
|
||
################################ | ||
# PYTHON-BASE | ||
# Sets up all our shared environment variables | ||
################################ | ||
FROM --platform=$TARGETPLATFORM python:3.11-slim as python-base | ||
|
||
ARG TARGETPLATFORM | ||
|
||
# python | ||
ENV PYTHONUNBUFFERED=1 \ | ||
# prevents python creating .pyc files | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
\ | ||
# pip | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
\ | ||
# poetry | ||
# https://python-poetry.org/docs/configuration/#using-environment-variables | ||
POETRY_VERSION=1.6.1 \ | ||
# make poetry install to this location | ||
POETRY_HOME="/opt/poetry" \ | ||
# make poetry create the virtual environment in the project's root | ||
# it gets named `.venv` | ||
POETRY_VIRTUALENVS_IN_PROJECT=true \ | ||
# do not ask any interactive question | ||
POETRY_NO_INTERACTION=1 \ | ||
\ | ||
# paths | ||
# this is where our requirements + virtual environment will live | ||
PYSETUP_PATH="/opt/pysetup" \ | ||
VENV_PATH="/opt/pysetup/.venv" | ||
|
||
|
||
# prepend poetry and venv to path | ||
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH" | ||
|
||
|
||
################################ | ||
# BUILDER-BASE | ||
# Used to build deps + create our virtual environment | ||
################################ | ||
FROM python-base as builder-base | ||
RUN apt-get update \ | ||
&& apt-get install --no-install-recommends -y \ | ||
# deps for installing poetry | ||
curl \ | ||
# deps for building python deps | ||
build-essential \ | ||
# git | ||
git | ||
|
||
# install poetry - respects $POETRY_VERSION & $POETRY_HOME | ||
# The --mount will mount the buildx cache directory to where | ||
# Poetry and Pip store their cache so that they can re-use it | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
# copy project requirement files here to ensure they will be cached. | ||
WORKDIR $PYSETUP_PATH | ||
COPY ../../poetry.lock pyproject.toml ./ | ||
|
||
# install runtime deps - uses $POETRY_VIRTUALENVS_IN_PROJECT internally | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
poetry install --with dagster,mlflow --without dagster-webserver | ||
|
||
################################ | ||
# PRODUCTION | ||
# Final image used for runtime | ||
################################ | ||
FROM python-base as production | ||
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH | ||
|
||
ADD ../../configs/jupyter_lab_config.py /root/.jupyter/jupyter_lab_config.py | ||
ADD ../../configs/jupytext.toml /root/.config/jupytext.toml | ||
|
||
WORKDIR /workshop | ||
EXPOSE 8888 4141 | ||
ENV SHELL="/bin/bash" | ||
ENV GIT_PYTHON_REFRESH="quiet" | ||
|
||
ENTRYPOINT ["jupyter", "lab"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.