mirror of
https://github.com/nightly-labs/openbot.git
synced 2026-12-03 02:00:16 +08:00
* Update a Docker instance from the app An instance of docker/instances now updates from Server settings and the update dialog. The container writes an empty request file to a folder that the host mounts. openbot-instance-update@<name>.path runs `openbot-instance update-request <name>` as root, which pulls the image and, for an install, makes the container again from a newer image only. Root writes the state to a folder that the container mounts read-only. The container never gets the Docker socket. The app uses HostedUpdateAdapter with the container folders when the host wrote update-status/enabled, and reports the method self-update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Limit the update requests of a Docker instance to a small tmpfs The container can write the request folder. As a folder on the disk of the host, it was outside the disk limit of the instance, so an agent could fill the host disk. It is now a tmpfs of 64 KiB and 16 files that /etc/fstab mounts before Docker starts. An instance with a fixed OPENBOT_TAG offers no update in the app, because a pull of that tag never gives a newer version. The keeper uses touch -c, so it does not make the state file again after the request ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
64 lines
3.3 KiB
Docker
64 lines
3.3 KiB
Docker
# syntax=docker/dockerfile:1
|
|
# The OpenBot Docker image: the Linux release, run as a self-hosted server (docs/docker.md). The
|
|
# release workflow builds it on a runner of each architecture, from the AppImage of that release,
|
|
# after it checks the AppImage against the release checksums:
|
|
#
|
|
# docker build --file docker/Dockerfile <folder that has OpenBot.AppImage>
|
|
#
|
|
# The server scripts and the package list come from the unpacked release, so they always match the
|
|
# build that they run.
|
|
ARG BASE=ubuntu:24.04@sha256:a853f94d226358a79c740cfc7bce0c289748f3fe3488d921d038ccd752c61b60
|
|
|
|
FROM ${BASE} AS release
|
|
# The AppImage runtime loads libz.so to unpack itself. Unpacked, the release needs no FUSE.
|
|
RUN apt-get update \
|
|
&& apt-get install --yes --no-install-recommends zlib1g-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
COPY OpenBot.AppImage /tmp/OpenBot.AppImage
|
|
WORKDIR /tmp
|
|
RUN chmod 0700 OpenBot.AppImage \
|
|
&& ./OpenBot.AppImage --appimage-extract >/dev/null \
|
|
&& chmod -R u+rwX,go=rX squashfs-root \
|
|
&& test -x squashfs-root/resources/hosting/openbot-container
|
|
|
|
FROM ${BASE}
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
COPY --from=release /tmp/squashfs-root/resources/hosting/packages.txt /tmp/packages.txt
|
|
# The packages of a self-hosted server, without AppArmor, which only the host can load. tini is PID 1:
|
|
# it reaps the processes that agents leave, and gives the stop signal to OpenBot, which stops them.
|
|
# Agents run their commands in this image, so it also has the tools that they use most.
|
|
RUN apt-get update \
|
|
&& sed -e '/^#/d' -e '/^$/d' -e '/^apparmor$/d' /tmp/packages.txt \
|
|
| xargs apt-get install --yes --no-install-recommends \
|
|
git less openssh-client procps ripgrep tini unzip xz-utils \
|
|
&& rm -rf /var/lib/apt/lists/* /tmp/packages.txt
|
|
# Not root. The image of Ubuntu has the user ubuntu with the UID 1000, which OpenBot takes. The home
|
|
# folder is the data volume.
|
|
RUN userdel --remove ubuntu \
|
|
&& useradd --uid 1000 --user-group --home-dir /data --create-home --shell /bin/bash openbot \
|
|
&& install -d -o openbot -g openbot -m 0700 /run/openbot
|
|
# Mount points of the update folders that docker/instances/compose.yaml gives an instance. Its root
|
|
# file system is read-only. With no folders mounted, OpenBot offers no update.
|
|
RUN install -d -m 0755 /var/lib/openbot-update/requests /var/lib/openbot-update/status
|
|
# Root owns the release, so the user and its agents cannot change it. chrome-sandbox has no SUID bit:
|
|
# the sandbox uses user namespaces, which the seccomp profile in docker/ permits.
|
|
COPY --from=release /tmp/squashfs-root /opt/OpenBot/app
|
|
RUN install -d -m 0755 /opt/OpenBot/hosted \
|
|
&& printf 'container\n' >/opt/OpenBot/hosted/mode \
|
|
&& ln -s /opt/OpenBot/app/resources/hosting/openbot /usr/local/bin/openbot
|
|
|
|
ARG VERSION=unknown
|
|
ARG REVISION=unknown
|
|
# GitHub links the package to the repository through `source`.
|
|
LABEL org.opencontainers.image.title=OpenBot \
|
|
org.opencontainers.image.source=https://github.com/nightly-labs/openbot \
|
|
org.opencontainers.image.licenses=PolyForm-Noncommercial-1.0.0 \
|
|
org.opencontainers.image.version=${VERSION} \
|
|
org.opencontainers.image.revision=${REVISION}
|
|
ENV LANG=C.UTF-8 XDG_RUNTIME_DIR=/run/openbot
|
|
USER openbot
|
|
WORKDIR /data
|
|
VOLUME /data
|
|
STOPSIGNAL SIGTERM
|
|
ENTRYPOINT ["/usr/bin/tini", "--", "/opt/OpenBot/app/resources/hosting/openbot-container"]
|