Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shouryashashank committed Apr 7, 2024
1 parent 7a662f3 commit 388ea69
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .dokerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Python
__pycache__
*.py[cod]
*.pyo
*.pyd
*.pyc

# Docker
Dockerfile
.dockerignore

# Git
.git
.gitignore

# Other
*.log
*.sql
*.sqlite
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

/__pycache__
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Use an official Python runtime as a parent image
FROM python:3.10-slim-buster

# Set the working directory in the container to /app
WORKDIR /app

# Add the current directory contents into the container at /app
COPY . /app

# Install any needed packages specified in requirements.txt
RUN pip install -r requirements.txt


7 changes: 7 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '3'
services:
predacons-server:
build: .
command: sh - c "uvicorn main:app --reload --port=8000 --host=0.0.0.0"
ports:
- "8000:8000"
20 changes: 20 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()

class Item(BaseModel):
name: str
description: str = None
price: float
tax: float = None

@app.get("/")
def read_root():
return {"Hello": "World"}

@app.post("/items/")
def create_item(item: Item):
return item


4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fastapi>=0.68.0,<0.69.0
pydantic>=1.8.0,<2.0.0
uvicorn>=0.15.0,<0.16.0
predacons>=0.0.117

0 comments on commit 388ea69

Please sign in to comment.