| CI builds the image, Modal serves it 5693bd5 nandi 10h 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}" |
| 9 | # The GitLab container registry is private, so Modal needs credentials to |
| 10 | # pull. A Modal Secret of this name holding REGISTRY_USERNAME and |
| 11 | # REGISTRY_PASSWORD -- a GitLab deploy token with `read_registry` is enough. |
| 12 | registry_secret = "gitlab-registry" |
| 13 | # Not a Sandbox: a Sandbox is a run that ends, and this is meant to stay up |
| 14 | # between pushes. `web` is a Function that Modal fronts with a stable https |
| 15 | # URL and `modal deploy` leaves running. |
| 16 | runtime = "web" |
| 17 | |
| 18 | [build] |
| 19 | # Empty, and that is the whole point of this container: the image is already |
| 20 | # what it should be. A copy here would add a layer to CI's image -- rebuilt |
| 21 | # and re-pushed at deploy time -- and the tree it copied would be the |
| 22 | # deploying machine's rather than the one that was built and tested. |
| 23 | include = [] |
| 24 | |
| 25 | [network] |
| 26 | ports = [8000] |
| 27 | |
| 28 | [resources] |
| 29 | # A static bundle over http.server. The cost is the pull, not the serving. |
| 30 | cpu = 1 |
| 31 | memory = 1024 |
| 32 | timeout = 3600 |
| 33 | # One container kept warm, so the URL answers without a cold pull after a |
| 34 | # quiet spell. Set it to 0 to pay that second or two instead. |
| 35 | min_containers = 1 |
| 36 | |
| 37 | [run] |
| 38 | workdir = "/srv" |
| 39 | # The image's own CMD, said again here because `web` starts the [run] command |
| 40 | # and not the CMD: one place says what runs, and `--shell` into this |
| 41 | # container gets the same line. |
| 42 | command = "python3 -m http.server 8000 --directory /srv/web" |