| CI builds the image, Modal serves it 5693bd5 nandi 12h ago | 1 | [container] |
| 2 | name = "frq-web" |
| 3 | description = "the web bundle CI built, served at a URL" |
| 4 | # Nothing is built here. `registry` is an image CI already made -- the |
| 5 | # Dockerfile beside this file -- and `${FRQ_WEB_IMAGE}` is expanded when this |
| 6 | # spec is read, so the tag is whatever commit the deploy job is deploying. |
| 7 | # Unset, it fails loudly rather than deploying something stale. |
| 8 | registry = "${FRQ_WEB_IMAGE}" |
| The registry it pushes to is the one it has 627b785 nandi 12h ago | 9 | # Images on registry.rickub.com are private by default, so Modal needs |
| 10 | # credentials to pull -- and it pulls on every cold start, not once at deploy |
| 11 | # time, so the CI job's own registry token is no use: it is short-lived by |
| 12 | # design. A Modal Secret of this name holds REGISTRY_USERNAME and |
| 13 | # REGISTRY_PASSWORD for a rickub *deploy* token, which is pull-only by |
| 14 | # construction. The username is a label of your choosing; only the token is |
| 15 | # checked. |
| 16 | registry_secret = "rickub-registry" |
| CI builds the image, Modal serves it 5693bd5 nandi 12h ago | 17 | # Not a Sandbox: a Sandbox is a run that ends, and this is meant to stay up |
| 18 | # between pushes. `web` is a Function that Modal fronts with a stable https |
| 19 | # URL and `modal deploy` leaves running. |
| 20 | runtime = "web" |
| 21 | |
| 22 | [build] |
| 23 | # Empty, and that is the whole point of this container: the image is already |
| 24 | # what it should be. A copy here would add a layer to CI's image -- rebuilt |
| 25 | # and re-pushed at deploy time -- and the tree it copied would be the |
| 26 | # deploying machine's rather than the one that was built and tested. |
| 27 | include = [] |
| 28 | |
| 29 | [network] |
| 30 | ports = [8000] |
| 31 | |
| 32 | [resources] |
| 33 | # A static bundle over http.server. The cost is the pull, not the serving. |
| 34 | cpu = 1 |
| 35 | memory = 1024 |
| 36 | timeout = 3600 |
| 37 | # One container kept warm, so the URL answers without a cold pull after a |
| 38 | # quiet spell. Set it to 0 to pay that second or two instead. |
| 39 | min_containers = 1 |
| 40 | |
| 41 | [run] |
| 42 | workdir = "/srv" |
| 43 | # The image's own CMD, said again here because `web` starts the [run] command |
| 44 | # and not the CMD: one place says what runs, and `--shell` into this |
| 45 | # container gets the same line. |
| 46 | command = "python3 -m http.server 8000 --directory /srv/web" |