Skip to content

Commit 2be9173

Browse files
GiniGini
authored andcommitted
fix: harden workspace image qualification
1 parent cbcc353 commit 2be9173

4 files changed

Lines changed: 17 additions & 5 deletions

File tree

compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,9 @@ services:
464464
profiles:
465465
- build
466466
image: ${ONECOMPUTER_WORKSPACE_IMAGE:-onecomputer/workspace:dev}
467+
# E2B Firecracker qualification and the pinned desktop artifacts target
468+
# x86_64. Keep local Apple Silicon builds deterministic under emulation.
469+
platform: ${ONECOMPUTER_WORKSPACE_PLATFORM:-linux/amd64}
467470
build:
468471
context: .
469472
dockerfile: docker/Dockerfile.workspace

docker/Dockerfile.workspace

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,17 @@ COPY --chmod=0755 --from=uv_source /usr/local/bin/uv /usr/local/bin/uvx /usr/loc
4646
COPY --chmod=0755 docker/workspace/onecomputer-libreoffice /usr/local/libexec/onecomputer-libreoffice
4747

4848
RUN export DEBIAN_FRONTEND=noninteractive \
49-
&& apt-get purge -y \
49+
&& purge_packages="$(for package in \
5050
code firefox gimp gimp-data google-chrome-stable \
5151
nextcloud-desktop nextcloud-desktop-common nextcloud-desktop-doc nextcloud-desktop-l10n \
5252
obs-studio obs-v4l2sink onlyoffice-desktopeditors \
5353
remmina remmina-common remmina-plugin-rdp remmina-plugin-secret remmina-plugin-spice remmina-plugin-vnc \
54-
signal-desktop slack-desktop sublime-text thunderbird zoom \
54+
signal-desktop slack-desktop sublime-text thunderbird zoom; do \
55+
if dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -q '^install ok installed$'; then \
56+
printf '%s ' "$package"; \
57+
fi; \
58+
done)" \
59+
&& if [ -n "$purge_packages" ]; then apt-get purge -y $purge_packages; fi \
5560
&& apt-get autoremove -y \
5661
&& curl -fsSLo /tmp/claude-desktop.deb \
5762
"https://downloads.claude.ai/claude-desktop/apt/stable/pool/main/c/claude-desktop/claude-desktop_${CLAUDE_DESKTOP_VERSION}_amd64.deb" \
@@ -278,6 +283,7 @@ RUN chmod 0755 \
278283
/usr/local/share/onecomputer/applications/onecomputer-google-chrome.desktop \
279284
/usr/local/share/onecomputer/applications/onecomputer-hermes-agent-cli.desktop \
280285
/usr/local/share/onecomputer/applications/onecomputer-hermes-desktop.desktop \
286+
&& command -v npm soffice libreoffice pandoc pdftoppm pdftotext qpdf tesseract unzip zip \
281287
&& test -f /opt/onecomputer/skills/make-a-site/SKILL.md \
282288
&& test -f /opt/onecomputer/hermes-agent/skills/onecomputer/make-a-site/SKILL.md \
283289
&& chmod 0644 /usr/share/kasmvnc/www/app/onecomputer-kasm-clipboard.js /opt/firefox/distribution/policies.json /etc/opt/chrome/policies/managed/onecomputer.json /usr/local/share/onecomputer/SCHEDULING.md \

docker/workspace/onecomputer-agent-chat.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,9 @@ def persist_attachment(filename: str, media_type: str, data: bytes, source: str)
474474
shutil.rmtree(message_directory, ignore_errors=True)
475475
shutil.rmtree(ATTACHMENT_INBOX_ROOT / ("Telegram" if source == "telegram" else "Chat") / attachment_id, ignore_errors=True)
476476
raise
477-
return str(path)
477+
# macOS exposes the temporary directory through both /var and /private/var;
478+
# return the canonical path so workspace references compare consistently.
479+
return str(path.resolve())
478480

479481

480482
def snapshot_outbox() -> dict[str, tuple[int, int, int, int]]:
@@ -491,7 +493,7 @@ def snapshot_outbox() -> dict[str, tuple[int, int, int, int]]:
491493
return snapshot
492494

493495

494-
def persist_outbox_artifacts(before: dict[str, tuple[int, int, int, int]]) -> tuple[list[dict[str, Any]], str | None]:
496+
def persist_outbox_artifacts(before: dict[str, tuple[int, int, int, int]]):
495497
ARTIFACT_ROOT.mkdir(mode=0o700, parents=True, exist_ok=True)
496498
os.chmod(ARTIFACT_ROOT, 0o700)
497499
artifacts: list[dict[str, Any]] = []

docker/workspace/onecomputer-hermes-config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ def atomic_json(path: Path, value: dict[str, Any]) -> None:
8383
encoding="utf-8",
8484
)
8585
os.chmod(temporary, 0o600)
86-
os.chown(temporary, 1000, 1000)
86+
if os.geteuid() == 0:
87+
os.chown(temporary, 1000, 1000)
8788
os.replace(temporary, path)
8889

8990

0 commit comments

Comments
 (0)