numerous-refrigerator-93306
08/18/2025, 3:47 AMFROM wpl-runtime-base AS wpl-poetry-runtime
LABEL "org.opencontainers.image.title"="wpl-poetry-runtime"
ARG ARCH
ARG TARGETPLATFORM
ARG MAMBA_ROOT_PREFIX
ARG OH_WORKSPACE_DIR
ARG OPENHANDS_BUILD_VERSION
ARG OPENVSCODE_SERVER_ROOT
ARG POETRY_VIRTUALENVS_PATH
ENV MAMBA_ROOT_PREFIX=${MAMBA_ROOT_PREFIX}
ENV OH_WORKSPACE_DIR=${OH_WORKSPACE_DIR}
ENV POETRY_VIRTUALENVS_PATH=${POETRY_VIRTUALENVS_PATH}
# Configure micromamba and poetry
# Create necessary directories
#
COPY ./code/pyproject.toml ./code/poetry.lock /openhands/code/
WORKDIR /openhands/code
SHELL ["/usr/bin/bash", "-o", "pipefail", "-c"]
# hadolint ignore=DL4006,SC2038
RUN --mount=type=cache,id="apt-lib-$TARGETPLATFORM",target="/var/lib/apt",sharing=locked \
--mount=type=cache,id="apt-cache-$TARGETPLATFORM",target="/var/cache/apt",sharing=locked \
--mount=type=cache,id="runtime-micromamba-pkgs-cache",target="/openhands/micromamba/pkgs/cache",sharing=locked \
--mount=type=cache,id="runtime-poetry-artifacts-cache",target="/root/.cache/pypoetry/artifacts",sharing=locked \
--mount=type=tmpfs,target="/tmp" \
--mount=type=tmpfs,target="/var/log" \
--mount=type=tmpfs,target="/var/log/apt" \
echo "Phase: Poetry Runtime" \
&& echo "Installing python-gitlab" \
&& /usr/local/bin/python3 -m pip install python-gitlab --break-system-packages \
&& echo "Successfully installed python-gitlab" \
&& mkdir -p /openhands/logs "${MAMBA_ROOT_PREFIX}/bin" "${POETRY_VIRTUALENVS_PATH}" \
&& PATH="/openhands/bin:${PATH}:/usr/local/go/bin:/usr/local/bin" \
&& export BIN_FOLDER="${MAMBA_ROOT_PREFIX}/bin" \
&& export PREFIX_LOCATION="${MAMBA_ROOT_PREFIX}" \
&& export INIT_YES="no" \
&& export CONDA_FORGE_YES="yes" \
&& wget -qO - https://micro.mamba.pm/install.sh%7C /usr/bin/bash \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" config remove channels defaults \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" config list \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" create -n openhands -y \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" install -n openhands -c conda-forge poetry python=3.12 -y \
&& mv /openhands/code/pyproject.toml /tmp \
&& mv /openhands/code/poetry.lock /tmp \
&& rm -rf /openhands/code/* \
&& install -D /dev/null /openhands/code/openhands/__init__.py \
&& mv /tmp/pyproject.toml /openhands/code \
&& mv /tmp/poetry.lock /openhands/code \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" config set changeps1 False \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" run -n openhands poetry config virtualenvs.path "${POETRY_VIRTUALENVS_PATH}" \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" run -n openhands poetry env use python3.12 \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" run -n openhands poetry install --only main --no-interaction --no-root \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" run -n openhands poetry install --only runtime --no-interaction --no-root \
&& apt-get update \
&& PKGS=(chromium) \
&& DEPS=(adwaita-icon-theme at-spi2-common chromium-common dbus dbus-bin dbus-daemon dbus-session-bus-common dbus-system-bus-common dbus-user-session dconf-gsettings-backend dconf-service gtk-update-icon-cache hicolor-icon-theme libatk-bridge2.0-0t64 libatk1.0-0t64 libatspi2.0-0t64 libavahi-client3 libavahi-common-data libavahi-common3 libcloudproviders0 libcolord2 libcups2t64 libdconf1 libdouble-conversion3 libepoxy0 libgtk-3-0t64 libgtk-3-common libharfbuzz-subset0 libice6 libminizip1t64 libnspr4 libnss3 libopenh264-8 libpam-systemd libsm6 libsystemd-shared libxaw7 libxcomposite1 libxdamage1 libxft2 libxinerama1 libxkbfile1 libxmu6 libxmuu1 libxnvctrl0 libxpm4 libxslt1.1 libxt6t64 libxtst6 libxxf86dga1 systemd systemd-sysv x11-utils xdg-utils) \
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y --no-install-recommends "${PKGS[@]}" "${DEPS[@]}" \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" run -n openhands poetry run pip install playwright \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" run -n openhands poetry run playwright install chromium \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" run -n openhands poetry run python -c "import sys; print('OH_INTERPRETER_PATH=' + sys.executable)" >> /etc/environment \
&& chmod -R g+rws "${POETRY_VIRTUALENVS_PATH}" \
&& if [ -d /openhands/workspace ]; then rm -rf /openhands/workspace ; fi \
&& ln -s "${OH_WORKSPACE_DIR}" /openhands/workspace \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" run -n openhands poetry cache clear --all . -n \
&& "${MAMBA_ROOT_PREFIX}/bin/micromamba" clean --all \
&& if [ -x /root/.cache/ms-playwright/ffmpeg-1011/ffmpeg-linux ]; then echo 'Linking Playwrights ffmpeg bin into system path'; ln -s /root/.cache/ms-playwright/ffmpeg-1011/ffmpeg-linux /usr/local/bin/ffmpeg; \
else echo 'it seems the ffmpeg binary isnt where we expected it. so wont link to /usr/local/bin/ffmpeg. This may cause problems for future you. Aloha.'; fi \
&& if [ -d /openhands/code/openhands ]; then rm -rf /openhands/code/openhands; fi \
&& echo "Removing documentation: https://wiki.ubuntu.com/ReducingDiskFootprint#Drop_unnecessary_files" \
&& find /usr/share/doc /tmp /var/log -depth -type f |xargs rm || true \
&& find /usr/share/doc -empty|xargs rmdir || true \
&& rm -rf /usr/share/man /usr/share/groff /usr/share/info /usr/share/lintian /usr/share/linda /var/cache/man \
&& echo "Removing Locales: https://wiki.ubuntu.com/ReducingDiskFootprint#Drop_unnecessary_files" \
&& find /usr/share/locale -mindepth 1 -maxdepth 1 ! -name 'en*' -exec rm -r {} + \
&& echo "Removing cruft" \
&& for PRUNE_TARGET in /home/pn /home/ubuntu /root/.cache/pip /root/.wget-hsts /tmp/install.log \
/usr/local/CHANGELOG.md /usr/local/README.md /usr/local/VERSION /var/cache/debconf/config.dat-old \
/var/cache/debconf/templates.dat-old /var/cache/ldconfig/aux-cache /var/lib/apt/lists/* \
/var/lib/dpkg/diversions-old /var/lib/dpkg/status-old /var/log/alternatives.log \
/var/log/apt/eipp.log.xz /var/log/apt/history.log /var/log/apt/term.log /var/log/dpkg.log; do \
if [ -d "${PRUNE_TARGET}" ]; then \
echo "Prune Target directory '${PRUNE_TARGET}' detected. Recursively Removing it."; rm -rf "${PRUNE_TARGET}"; \
elif [ -f "${PRUNE_TARGET}" ]; then \
echo "Prune Target file '${PRUNE_TARGET}' detected. Removing it."; rm "${PRUNE_TARGET}"; \
else \
echo "NOOP on non-existent prune target '${PRUNE_TARGET}'"; \
fi; \
done
SEEMS to work? (I just finished building it and started OH up and the frontend connected to the runtime and it's seemingly doin a thing... so I'll report back if anything acts up (I still have to pull in the last few days' changes y'all made ... saw some nifty microagent additions 🙂 lookin forward to playing with them ...