1+ # ###################################################################################################
2+ # builder: install needed dependencies
3+ # ###################################################################################################
4+
5+ FROM python:3.10-slim-bullseye AS builder
6+
7+ ENV PYTHONFAULTHANDLER=1 \
8+ PYTHONUNBUFFERED=1 \
9+ PYTHONHASHSEED=random \
10+ PIP_NO_CACHE_DIR=on \
11+ PIP_DISABLE_PIP_VERSION_CHECK=on \
12+ PIP_DEFAULT_TIMEOUT=100 \
13+ POETRY_VERSION=1.2.2 \
14+ POETRY_HOME="/opt/poetry" \
15+ POETRY_VIRTUALENVS_IN_PROJECT=true \
16+ POETRY_NO_INTERACTION=1 \
17+ PYSETUP_PATH="/opt/pysetup" \
18+ VENV_PATH="/opt/pysetup/.venv"
19+
20+ ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
21+
22+ RUN apt-get update \
23+ && apt-get install --no-install-recommends -y \
24+ curl \
25+ wget \
26+ # deps for building python deps
27+ build-essential \
28+ && apt-get install -y git \
29+ && apt-get clean && rm -rf /var/lib/apt/lists/* \
30+ \
31+ # install dumb-init
32+ && wget -O /dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64 \
33+ && chmod +x /dumb-init \
34+ && curl -sSL https://install.python-poetry.org | python3 -
35+
36+ # ###################################################################################################
37+ # udf: used for running the udf vertices
38+ # ###################################################################################################
39+ FROM builder AS udf
40+
41+ WORKDIR $PYSETUP_PATH
42+ COPY pyproject.toml ./
43+ RUN poetry install --no-cache --no-root && \
44+ rm -rf ~/.cache/pypoetry/
45+
46+ ADD . /app
47+ WORKDIR /app
48+
49+ RUN chmod +x entry.sh
50+
51+ ENTRYPOINT ["/dumb-init" , "--" ]
52+ CMD ["/app/entry.sh" ]
53+
54+ EXPOSE 5000
0 commit comments