Added FastAPI development environment
This commit is contained in:
parent
0abec5d977
commit
5e2ad14d7b
7 changed files with 46 additions and 1 deletions
|
@ -4,7 +4,7 @@ services:
|
|||
immich_server:
|
||||
image: immich-server-dev:1.0.0
|
||||
build:
|
||||
context: .
|
||||
context: ../server
|
||||
target: development
|
||||
dockerfile: ../server/Dockerfile
|
||||
command: npm run start:dev
|
||||
|
@ -60,6 +60,22 @@ services:
|
|||
depends_on:
|
||||
- immich_server
|
||||
|
||||
machine_learning_fast_api:
|
||||
image: immich-tensor-flow:1.0.0
|
||||
restart: always
|
||||
build:
|
||||
context: ../machine_learning
|
||||
dockerfile: ../machine_learning/Dockerfile
|
||||
volumes:
|
||||
- ../machine_learning/app:/code/app
|
||||
ports:
|
||||
- 2285:8000
|
||||
expose:
|
||||
- "8000"
|
||||
depends_on:
|
||||
- database
|
||||
networks:
|
||||
- immich_network
|
||||
networks:
|
||||
immich_network:
|
||||
volumes:
|
||||
|
|
11
machine_learning/Dockerfile
Normal file
11
machine_learning/Dockerfile
Normal file
|
@ -0,0 +1,11 @@
|
|||
FROM python:3.9
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
COPY ./requirements.txt /code/requirements.txt
|
||||
|
||||
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
||||
|
||||
COPY ./app /code/app
|
||||
|
||||
CMD ["uvicorn", "app.main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
0
machine_learning/app/__init__.py
Normal file
0
machine_learning/app/__init__.py
Normal file
BIN
machine_learning/app/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
machine_learning/app/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
machine_learning/app/__pycache__/main.cpython-39.pyc
Normal file
BIN
machine_learning/app/__pycache__/main.cpython-39.pyc
Normal file
Binary file not shown.
15
machine_learning/app/main.py
Normal file
15
machine_learning/app/main.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
from typing import Optional
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def read_root():
|
||||
return {"Hello": "World 312"}
|
||||
|
||||
|
||||
@app.get("/items/{item_id}")
|
||||
def read_item(item_id: int, q: Optional[str] = None):
|
||||
return {"item_id": item_id, "q": q}
|
3
machine_learning/requirements.txt
Normal file
3
machine_learning/requirements.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
fastapi>=0.68.0,<0.69.0
|
||||
pydantic>=1.8.0,<2.0.0
|
||||
uvicorn>=0.15.0,<0.16.0
|
Loading…
Add table
Reference in a new issue