-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
90 additions
and
34 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,44 @@ | ||
ARG PYTHON_VERSION="3.12" | ||
|
||
############################################################################### | ||
# 1. install python connector dependencies | ||
############################################################################### | ||
# poetry setup code copied from https://github.com/thehale/docker-python-poetry, due to missing multiarch images | ||
# POETRY BASE IMAGE - Provides environment variables for poetry | ||
FROM python:${PYTHON_VERSION}-slim AS python-poetry-base | ||
ARG POETRY_VERSION="1.6.1" | ||
ENV POETRY_VERSION=${POETRY_VERSION} | ||
ENV POETRY_HOME="/opt/poetry" | ||
ENV POETRY_VIRTUALENVS_IN_PROJECT=true | ||
ENV POETRY_NO_INTERACTION=1 | ||
ENV PATH="$POETRY_HOME/bin:$PATH" | ||
# POETRY BUILDER IMAGE - Installs Poetry and dependencies | ||
FROM python-poetry-base AS python-poetry-builder | ||
RUN apt-get update && apt-get install -y --no-install-recommends curl | ||
# Install Poetry via the official installer: https://python-poetry.org/docs/master/#installing-with-the-official-installer | ||
# This script respects $POETRY_VERSION & $POETRY_HOME | ||
RUN curl -sSL https://install.python-poetry.org | python3 - | ||
# POETRY RUNTIME IMAGE - Copies the poetry installation into a smaller image and builds target app | ||
FROM python-poetry-base AS build-python | ||
COPY --from=python-poetry-builder $POETRY_HOME $POETRY_HOME | ||
# only install dependencies into project virtualenv | ||
COPY bpm-ai-connectors-c8/pyproject.toml bpm-ai-connectors-c8/poetry.lock ./app/ | ||
WORKDIR /app | ||
RUN poetry install --without dev,test --no-root --no-cache | ||
|
||
############################################################################### | ||
# 3. Final, minimal image | ||
############################################################################### | ||
FROM cgr.dev/chainguard/python:latest | ||
|
||
ARG PYTHON_VERSION | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
WORKDIR /app | ||
COPY ./feel-engine-wrapper/target/*-runner feel-wrapper | ||
COPY ./bpm-ai-connectors-c8/bpm_ai_connectors_c8/ ./bpm_ai_connectors_c8/ | ||
COPY --from=build-python /app/.venv/lib/python${PYTHON_VERSION}/site-packages /home/nonroot/.local/lib/python${PYTHON_VERSION}/site-packages | ||
|
||
# Run two processes: connector runtime + feel engine wrapper | ||
COPY docker/init.py . | ||
CMD ["init.py", "./feel-wrapper", "python -m bpm_ai_connectors_c8.main"] |