Spaces:
Runtime error
Runtime error
Added files
Browse files- Dockerfile +31 -0
- main.py +7 -0
- requirements.txt +2 -0
Dockerfile
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# FROM python:3.9
|
2 |
+
|
3 |
+
# WORKDIR /code
|
4 |
+
|
5 |
+
# COPY ./requirements.txt /code/requirements.txt
|
6 |
+
|
7 |
+
# RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
+
|
9 |
+
# RUN useradd -m -u 1000 user
|
10 |
+
# USER user
|
11 |
+
# ENV HOME=/home/user \
|
12 |
+
# PATH=/home/user/.local/bin:$PATH
|
13 |
+
|
14 |
+
# WORKDIR $HOME/app
|
15 |
+
|
16 |
+
# COPY --chown=user . $HOME/app
|
17 |
+
|
18 |
+
# CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
19 |
+
|
20 |
+
FROM python:3.9
|
21 |
+
|
22 |
+
WORKDIR /code
|
23 |
+
|
24 |
+
COPY ./requirements.txt /code/requirements.txt
|
25 |
+
|
26 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
27 |
+
|
28 |
+
COPY . .
|
29 |
+
|
30 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
31 |
+
|
main.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
2 |
+
|
3 |
+
app = FastAPI()
|
4 |
+
|
5 |
+
@app.get("/")
|
6 |
+
def read_root():
|
7 |
+
return {"Hello": "World!"}
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastapi[all]
|
2 |
+
uvicorn[standard]
|