Spaces:
Running
Running
File size: 2,401 Bytes
31e7814 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# OpenEnv Base Image
Standard base image for all OpenEnv environment servers.
## What's Included
| Layer | Size | Contents |
|-------|------|----------|
| python:3.11-slim | 200 MB | Base Python runtime |
| + Dependencies | 100 MB | FastAPI, uvicorn, requests |
| **Total** | **~300 MB** | Ready for environment servers |
## Image Sizes
```
openenv-base:latest 300 MB (python + fastapi + uvicorn)
```
echo-env:latest 500 MB (python + fastapi + uvicorn + app)
coding-env:latest 520 MB (python + fastapi + uvicorn + app + tools)
another-env:latest 510 MB (python + fastapi + uvicorn + app)
---
Total: 1.5 GB (with lots of duplication)
```
### With Base Images (✅ Solution)
```
openenv-base:latest 300 MB (python + fastapi + uvicorn)
echo-env:latest 50 MB (app only, uses base)
coding-env:latest 70 MB (app + tools, uses base)
another-env:latest 45 MB (app only, uses base)
---
Total: 465 MB (base shared, minimal duplication)
```
## Building the Base Image
```bash
# From project root
docker build -t openenv-base:latest -f src/core/containers/images/Dockerfile .
```
## Usage in Environment Dockerfiles
Each environment Dockerfile should start with:
```dockerfile
FROM openenv-base:latest
# Copy only environment-specific files
COPY src/core/ /app/src/core/
COPY src/envs/my_env/ /app/src/envs/my_env/
# Run the server
CMD ["uvicorn", "envs.my_env.server.app:app", "--host", "0.0.0.0", "--port", "8000"]
```
## Base Image Contents
- Python 3.11-slim
- FastAPI >= 0.104.0
- Uvicorn >= 0.24.0
- Requests >= 2.25.0
- curl (for health checks)
## Example: Building Echo Environment
```bash
# Step 1: Build base image (do this once)
docker build -t openenv-base:latest -f src/core/containers/images/Dockerfile .
# Step 2: Build echo environment (uses base)
docker build -t echo-env:latest -f src/envs/echo_env/server/Dockerfile .
# Step 3: Run echo environment
docker run -p 8000:8000 echo-env:latest
```
## Updating the Base
When dependencies need updating:
1. Update `src/core/containers/images/Dockerfile`
2. Rebuild base image
3. Rebuild all environment images (they'll use new base)
```bash
# Update base
docker build -t openenv-base:latest -f src/core/containers/images/Dockerfile .
# Rebuild environments (they automatically use new base)
docker build -t echo-env:latest -f src/envs/echo_env/server/Dockerfile .
```
|