From a35d70412c65745ed354b59adb116e4d738a88a7 Mon Sep 17 00:00:00 2001 From: Philipp Rothmann Date: Wed, 2 Mar 2022 16:10:17 +0100 Subject: [PATCH] init --- .dockerignore | 3 +++ .gitignore | 2 ++ Dockerfile | 4 ++++ README.md | 17 +++++++++++++++++ app/main.py | 8 ++++++++ app/test.py | 11 +++++++++++ docker-compose.yml | 11 +++++++++++ requirements.txt | 11 +++++++++++ 8 files changed, 67 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 app/main.py create mode 100644 app/test.py create mode 100644 docker-compose.yml create mode 100644 requirements.txt diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b6d56b8 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +env +__pycache__ +.git \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3cf8c6d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +env +__pycache__ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..49f56f6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8 +COPY requirements.txt /app +RUN pip install -r /app/requirements.txt +COPY ./app /app diff --git a/README.md b/README.md new file mode 100644 index 0000000..f04b1ab --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# integrate + +does what nobody else want's to do. + +## Development + +### Getting Started + +``` +python3 -m venv env +. ./env/bin/activate +pip3 install -r requirements.txt +./env/bin/uvicorn app.main:app --reload +``` + + +pip freeze -l > requirements.txt \ No newline at end of file diff --git a/app/main.py b/app/main.py new file mode 100644 index 0000000..d786432 --- /dev/null +++ b/app/main.py @@ -0,0 +1,8 @@ +from fastapi import FastAPI + +app = FastAPI() + + +@app.get("/") +async def root(): + return {"message": "Hello World"} \ No newline at end of file diff --git a/app/test.py b/app/test.py new file mode 100644 index 0000000..ddc013f --- /dev/null +++ b/app/test.py @@ -0,0 +1,11 @@ +from fastapi.testclient import TestClient + +from .main import app + +client = TestClient(app) + + +def test_read_main(): + response = client.get("/") + assert response.status_code == 200 + assert response.json() == {"msg": "Hello World"} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0a298de --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +services: + app: + build: . + environment: + # APP_MODULE: app.main:app + # BIND: 0.0.0.0 + # PORT: 80 + LOG_LEVEL: debug + ports: + - 8080:80 + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6c9b0d6 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,11 @@ +anyio==3.5.0 +asgiref==3.5.0 +click==8.0.4 +fastapi==0.74.1 +h11==0.13.0 +idna==3.3 +pydantic==1.9.0 +sniffio==1.2.0 +starlette==0.17.1 +typing_extensions==4.1.1 +uvicorn==0.17.5