-
Notifications
You must be signed in to change notification settings - Fork 138
/
Dockerfile
93 lines (77 loc) · 2.87 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# ----------------------------------------- #
# Base
# ----------------------------------------- #
FROM python:3.8.5-slim AS base
ARG COURSE_WEEK
ENV VIRTUAL_ENV=/opt/venv
ENV DAGSTER_HOME=/opt/dagster/dagster_home
ENV POETRY_VERSION=1.1.12
ENV POETRY_HOME=/opt/poetry
# ----------------------------------------- #
# Builder
# ----------------------------------------- #
FROM base AS builder
RUN python -m venv "$VIRTUAL_ENV" && \
mkdir -p "$DAGSTER_HOME"
ENV PATH="$VIRTUAL_ENV/bin:$POETRY_HOME/bin:$PATH"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -y --no-install-recommends \
curl \
build-essential \
libpq-dev && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/* && \
curl -sSL https://install.python-poetry.org | python -
COPY poetry.lock pyproject.toml /
RUN pip install --no-cache-dir --upgrade pip==21.3.1 setuptools==60.2.0 wheel==0.37.1 && \
poetry config virtualenvs.path "$VIRTUAL_ENV" && \
poetry install --no-root --no-interaction --no-ansi --no-dev
# ----------------------------------------- #
# Runner
# ----------------------------------------- #
FROM base AS runner
ARG COURSE_WEEK
ENV PATH="$VIRTUAL_ENV/bin:$POETRY_HOME/bin:$PATH"
RUN groupadd -r dagster && useradd -m -r -g dagster dagster
COPY --from=builder $VIRTUAL_ENV $VIRTUAL_ENV
COPY --from=builder --chown=dagster $DAGSTER_HOME $DAGSTER_HOME
WORKDIR $DAGSTER_HOME
# ----------------------------------------- #
# Dagit
# ----------------------------------------- #
FROM runner AS dagit
# USER dagster:dagster
EXPOSE 3000
CMD ["dagit", "-h", "0.0.0.0", "--port", "3000", "-w", "workspace.yaml"]
# ----------------------------------------- #
# Daemon
# ----------------------------------------- #
FROM runner AS daemon
# USER dagster:dagster
CMD ["dagster-daemon", "run"]
# ----------------------------------------- #
# Code Locations
# ----------------------------------------- #
FROM runner AS content
ENV DAGSTER_CURRENT_IMAGE=corise-dagster-answer-key_content
ARG COURSE_WEEK
COPY ${COURSE_WEEK}/workspaces/ ./workspaces
USER dagster:dagster
EXPOSE 4000
CMD ["dagster", "api", "grpc", "-h", "0.0.0.0", "-p", "4000", "-f", "workspaces/content/deployment.py"]
FROM runner AS project
ENV DAGSTER_CURRENT_IMAGE=corise-dagster-answer-key_project
ARG COURSE_WEEK
COPY ${COURSE_WEEK}/workspaces/ ./workspaces
USER dagster:dagster
EXPOSE 4001
CMD ["dagster", "api", "grpc", "-h", "0.0.0.0", "-p", "4001", "-f", "workspaces/project/deployment.py"]
FROM runner AS challenge
ENV DAGSTER_CURRENT_IMAGE=corise-dagster-answer-key_challenge
ARG COURSE_WEEK
COPY ${COURSE_WEEK}/workspaces/ ./workspaces
USER dagster:dagster
EXPOSE 4002
CMD ["dagster", "api", "grpc", "-h", "0.0.0.0", "-p", "4002", "-f", "workspaces/challenge/deployment.py"]