Apply @appcypher's recommendations for microsandbox Docker configuration

Co-authored-by: Sun-ZhenXing <44517244+Sun-ZhenXing@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-15 07:43:19 +00:00
parent 3044032943
commit e263ddf084
5 changed files with 110 additions and 65 deletions

View File

@@ -2,7 +2,7 @@ ARG DEBIAN_VERSION=13.2-slim
FROM debian:${DEBIAN_VERSION}
ARG DEBIAN_FRONTEND=noninteractive
ARG MICROSANDBOX_VERSION=0.2.6
ARG MICROSANDBOX_VERSION
ARG TARGETARCH
RUN apt update && \
@@ -12,32 +12,22 @@ RUN apt update && \
apt clean && \
rm -rf /var/lib/apt/lists/*
# Download and install microsandbox binary based on architecture
RUN ARCH=${TARGETARCH:-amd64} && \
case "${ARCH}" in \
amd64) MICROSANDBOX_ARCH="x86_64" ;; \
arm64) MICROSANDBOX_ARCH="aarch64" ;; \
*) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \
esac && \
curl -fsSL "https://github.com/zerocore-ai/microsandbox/releases/download/microsandbox-v${MICROSANDBOX_VERSION}/microsandbox-${MICROSANDBOX_VERSION}-linux-${MICROSANDBOX_ARCH}.tar.gz" \
-o /tmp/microsandbox.tar.gz && \
mkdir -p /usr/local/bin /usr/local/lib && \
tar -xzf /tmp/microsandbox.tar.gz -C /tmp && \
cd /tmp/microsandbox-${MICROSANDBOX_VERSION}-linux-${MICROSANDBOX_ARCH} && \
mv ms* /usr/local/bin/ && \
mv *.so.* /usr/local/lib/ && \
chmod +x /usr/local/bin/ms* && \
rm -rf /tmp/microsandbox*
# Install microsandbox using the official install script
# This ensures we always get the latest version if MICROSANDBOX_VERSION is not set
# and handles architecture detection automatically
RUN VERSION="${MICROSANDBOX_VERSION:-}" \
curl -fsSL https://raw.githubusercontent.com/zerocore-ai/microsandbox/refs/heads/main/scripts/install_microsandbox.sh | sh
# Setup directories for root user
RUN mkdir -p /root/.local/bin /root/.local/lib /root/.microsandbox
# Set up environment variables (based on setup_env.sh)
# Set up environment variables
ENV PATH="/root/.local/bin:/usr/local/bin:${PATH}"
ENV LD_LIBRARY_PATH="/root/.local/lib:/usr/local/lib:${LD_LIBRARY_PATH}"
ENV HOME="/root"
WORKDIR /root
# Set working directory to match docker-compose working_dir
WORKDIR /workspace
ARG MICROSANDBOX_AUTO_PULL_IMAGES=true
RUN if [ "${MICROSANDBOX_AUTO_PULL_IMAGES}" = "true" ]; then \