doc: modular sandbox configs
This commit is contained in:
parent
50dc6a71d1
commit
99cef70dab
|
|
@ -47,7 +47,7 @@ docker build --file images/python/Dockerfile --tag codapi/python:latest images/p
|
||||||
|
|
||||||
And register the image as a Codapi _box_ in `configs/boxes.json`:
|
And register the image as a Codapi _box_ in `configs/boxes.json`:
|
||||||
|
|
||||||
```json
|
```js
|
||||||
{
|
{
|
||||||
// ...
|
// ...
|
||||||
"python": {
|
"python": {
|
||||||
|
|
@ -56,12 +56,10 @@ And register the image as a Codapi _box_ in `configs/boxes.json`:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, let's configure what happens when the client executes the `run` command in the `python` sandbox. To do this, we edit `configs/commands.json`:
|
Finally, let's configure what happens when the client executes the `run` command in the `python` sandbox. To do this, we create `configs/commands/python.json`:
|
||||||
|
|
||||||
```json
|
```js
|
||||||
{
|
{
|
||||||
// ...
|
|
||||||
"python": {
|
|
||||||
"run": {
|
"run": {
|
||||||
"engine": "docker",
|
"engine": "docker",
|
||||||
"entry": "main.py",
|
"entry": "main.py",
|
||||||
|
|
@ -72,7 +70,6 @@ Finally, let's configure what happens when the client executes the `run` command
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -80,12 +77,10 @@ This is essentially what it says:
|
||||||
|
|
||||||
> When the client executes the `run` command in the `python` sandbox, save their code to the `main.py` file, then run it in the `python` box (Docker container) using the `python main.py` shell command.
|
> When the client executes the `run` command in the `python` sandbox, save their code to the `main.py` file, then run it in the `python` box (Docker container) using the `python main.py` shell command.
|
||||||
|
|
||||||
What if we want to add another command (say, `test`) to the same sandbox? Let's edit `configs/commands.json` again:
|
What if we want to add another command (say, `test`) to the same sandbox? Let's edit `configs/commands/python.json` again:
|
||||||
|
|
||||||
```json
|
```js
|
||||||
{
|
{
|
||||||
// ...
|
|
||||||
"python": {
|
|
||||||
"run": {
|
"run": {
|
||||||
// ...
|
// ...
|
||||||
},
|
},
|
||||||
|
|
@ -100,7 +95,6 @@ What if we want to add another command (say, `test`) to the same sandbox? Let's
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user