jessehostetler commited on
Commit
fcd4ad7
·
1 Parent(s): 36ddfc8

Add instructions for testing that container works without internet access.

Browse files
Files changed (2) hide show
  1. README.md +35 -0
  2. makefile +4 -0
README.md CHANGED
@@ -52,6 +52,15 @@ make docker-run
52
 
53
  The Docker container also runs the server at `http://127.0.0.1:8000`.
54
 
 
 
 
 
 
 
 
 
 
55
 
56
  ## What Happens When You Start the Server
57
 
@@ -93,6 +102,32 @@ Example response:
93
  }
94
  ```
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
  # How to participate
98
 
 
52
 
53
  The Docker container also runs the server at `http://127.0.0.1:8000`.
54
 
55
+ ## Test that your container works without Internet access
56
+ Your submission will run without access to the Internet. You can test that your container starts successfully without Internet access by setting `--network none` in your `docker run` command:
57
+
58
+ ```bash
59
+ make docker-test-no-internet
60
+ ```
61
+
62
+ Note that this won't catch Internet access that happens in your `/predict` endpoint.
63
+
64
 
65
  ## What Happens When You Start the Server
66
 
 
102
  }
103
  ```
104
 
105
+ ## Testing `/predict` without Internet access
106
+
107
+ If you run your Docker container with `--network none` (for example, via `make docker-test-no-internet`), you can't make HTTP requests to it from outside. To test how your system functions without Internet access, you must first `exec` into the container:
108
+
109
+ ```bash
110
+ # In one terminal, start the container
111
+ make docker-test-no-internet
112
+ ```
113
+
114
+ ```bash
115
+ # In a second terminal, exec into the container
116
+ docker ps
117
+
118
+ <note the name of your container>
119
+
120
+ docker exec -it <container name> /bin/bash
121
+ ```
122
+
123
+ Inside the container, you can make requests via Python:
124
+ ```
125
+ root@cff6d5fdb23c:/app# python
126
+ >>> import requests
127
+ >>> requests.post("http://localhost:8000/predict", headers={"Content-Type": "application/json"}, data=...)
128
+ ```
129
+
130
+ Replace the `...` with a real JSON request, such as the one generated by the `prompt.sh` script.
131
 
132
  # How to participate
133
 
makefile CHANGED
@@ -25,6 +25,10 @@ docker-build:
25
  docker-run:
26
  docker run --rm -it -p 8000:8000 $(IMAGE)
27
 
 
 
 
 
28
  .PHONY: compile
29
  compile:
30
  uv pip compile --python-version 3.12 --upgrade -o requirements.torch.cpu.txt.tmp requirements.torch.cpu.in
 
25
  docker-run:
26
  docker run --rm -it -p 8000:8000 $(IMAGE)
27
 
28
+ .PHONY: docker-test-no-internet
29
+ docker-test-no-internet:
30
+ docker run --rm -it --network none $(IMAGE)
31
+
32
  .PHONY: compile
33
  compile:
34
  uv pip compile --python-version 3.12 --upgrade -o requirements.torch.cpu.txt.tmp requirements.torch.cpu.in