Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds Docker support to microsandbox by introducing a Dockerfile and docker-compose.yaml configuration, enabling users to run the sandbox server via docker compose up -d. The implementation provides a containerized environment with configurable resources, automatic SDK image pulling, and necessary device access for KVM virtualization.
Key Changes
- Added Dockerfile that builds a Debian-based image with microsandbox binaries for amd64 and arm64 architectures
- Added docker-compose.yaml with service configuration including privileged mode, device mappings, volume management, and resource limits
- Configured automatic pulling of Python and Node SDK images during build (optional via build arg)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
| Dockerfile | Defines multi-architecture build process for microsandbox container image with dependency installation and SDK image pre-pulling |
| docker-compose.yaml | Provides service configuration with environment variables, port mappings, volumes, device access, and resource constraints for running microsandbox |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
appcypher
left a comment
There was a problem hiding this comment.
Thanks for the contribution. I have some made come comments for changes and re-evaluation. Thanks again
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
I made additional modifications to When using the installation script, I can only use |
|
This looks good to me. I will need to setup a CI for the ghcr image release based of this branch. So it might take a bit. |
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Download and install microsandbox binary | ||
| RUN VERSION ="${MICROSANDBOX_VERSION:-}" \ |
There was a problem hiding this comment.
| RUN VERSION ="${MICROSANDBOX_VERSION:-}" \ | |
| RUN VERSION="${MICROSANDBOX_VERSION:-}" \ |
| command: | ||
| - /bin/sh | ||
| - -c | ||
| - > | ||
| if [ "${MICROSANDBOX_DEV_MODE:-true}" = "true" ]; then | ||
| DEV_FLAG="--dev"; | ||
| else | ||
| DEV_FLAG=""; | ||
| fi; | ||
| exec server start --host 0.0.0.0 --port ${MICROSANDBOX_PORT:-5555} ${DEV_FLAG}; |
There was a problem hiding this comment.
| command: | |
| - /bin/sh | |
| - -c | |
| - > | |
| if [ "${MICROSANDBOX_DEV_MODE:-true}" = "true" ]; then | |
| DEV_FLAG="--dev"; | |
| else | |
| DEV_FLAG=""; | |
| fi; | |
| exec server start --host 0.0.0.0 --port ${MICROSANDBOX_PORT:-5555} ${DEV_FLAG}; | |
| entrypoint: ["sh", "-c"] | |
| command: | |
| - | | |
| DEV_FLAG="" | |
| if [ "${MICROSANDBOX_DEV_MODE}" = "true" ]; then | |
| DEV_FLAG="--dev" | |
| fi | |
| exec msb server start --host 0.0.0.0 --port ${MICROSANDBOX_PORT:-5555} $$DEV_FLAG |
Main problem is that the DEV_FLAG variable needs to be escaped.
It would be cleaner to handle the entire dev mode stuff in the Dockerfile though.
|
|
||
| # Download and install microsandbox binary | ||
| RUN VERSION ="${MICROSANDBOX_VERSION:-}" \ | ||
| curl -fsSL https://raw.githubusercontent.com/zerocore-ai/microsandbox/refs/heads/main/scripts/install_microsandbox.sh | sh |
There was a problem hiding this comment.
Would recommend to copy the source code and compile it in the docker build process. This makes releasing a lot easier.
| cd docker | ||
| docker-compose build |
There was a problem hiding this comment.
| cd docker | |
| docker-compose build | |
| docker compose -f docker/docker-compose.yaml build |
More consistent with the other examples
|
@Sun-ZhenXing apologies for the delay in getting this merged in. given the recent changes (v0.3.7), it'd be nice if you could update this PR. thanks 🙏🏽 |
I've added a buildable Dockerfile that can be started directly with
docker compose up -d.