feat: publishing infernet-container-starter v0.2.0

This commit is contained in:
ritual-all
2024-03-29 10:50:13 -04:00
parent 41aaa152e6
commit 4545223364
155 changed files with 6086 additions and 257 deletions

View File

@ -4,15 +4,20 @@ WORKDIR /app
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PIP_NO_CACHE_DIR 1
ENV RUNTIME docker
ENV PYTHONPATH src
WORKDIR /app
RUN apt-get update
RUN apt-get install -y git curl
# install uv
ADD --chmod=755 https://astral.sh/uv/install.sh /install.sh
RUN /install.sh && rm /install.sh
COPY src/requirements.txt .
RUN pip install --upgrade pip && pip install -r requirements.txt
RUN /root/.cargo/bin/uv pip install --system --no-cache -r requirements.txt
COPY src src

View File

@ -3,8 +3,8 @@
In this tutorial, we'll create a simple hello-world container that can be used
with infernet.
> [!NOTE]
> This directory `containers/hello-world` already includes the final result
> [!NOTE]
> This directory `containers/hello-world` already includes the final result
> of this tutorial. Run the following tutorial in a new directory.
Let's get started! 🎉
@ -88,7 +88,7 @@ This is a simple Dockerfile that:
3. Copies the source code
4. Runs the app on port `3000`
> [!IMPORTANT]
> [!IMPORTANT]
> App must be exposed on port `3000`. Infernet's orchestrator
> will always assume that the container apps are exposed on that port within the container.
> Users can then remap this port to any port that they want on the host machine
@ -127,7 +127,7 @@ docker run --rm -p 3000:3000 --name hello hello-world
In another terminal, run:
```
curl localhost:3000
curl "localhost:3000"
```
It should return something like:
@ -159,5 +159,5 @@ The output should be something like:
Your users will never call this endpoint directly. Instead, they will:
1. Either [create an off-chain job request](../../../README.md#L36) through the node API
1. Either [create an off-chain job request](../hello-world#L36) through the node API
2. Or they will make a subscription on their contracts

View File

@ -1,9 +1,10 @@
from time import sleep
from typing import Any
import requests
def hit_server_directly():
def hit_server_directly() -> None:
print("hello")
r = requests.get("http://localhost:3000/")
print(r.status_code)
@ -11,7 +12,7 @@ def hit_server_directly():
print("server response", r.text)
def poll_until_complete(id: str):
def poll_until_complete(id: str) -> Any:
status = "running"
r = None
while status == "running":
@ -24,11 +25,12 @@ def poll_until_complete(id: str):
status = r.get("status")
print("status", status)
if status != "running":
return r
break
sleep(1)
return r
def create_job_through_node():
def create_job_through_node() -> None:
r = requests.post(
"http://localhost:4000/api/jobs",
json={

View File

@ -1,2 +1,2 @@
Flask>=3.0.0,<4.0.0
gunicorn>=21.2.0,<22.0.0
gunicorn>=21.2.0,<22.0.0