Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:3.10-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
RUN touch /app/users.db
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ cd SimpleFastPyAPI
Install the project dependencies:

```bash
pip install -r requirements.txt
docker build -t SimpleFastPyAPI .
```

Run the application:

```bash
uvicorn main:app --reload
docker run -p 8000:8000 -v $(pwd)/users.db:/app/users.db SimpleFastPyAPI
```

The application will start and be available at http://localhost:8000.
Expand Down
3 changes: 1 addition & 2 deletions app/database.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker


DATABASE_URL = "sqlite:///../users.db"
DATABASE_URL = "sqlite:///./users.db"

engine = create_engine(DATABASE_URL)

Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ requests==2.32.0
rfc3986==1.5.0
sniffio==1.3.0
SQLAlchemy==1.4.47
starlette==0.40.0
starlette==0.35.0
typing==3.7.4.3
typing_extensions==4.5.0
typing_extensions==4.8.0
ujson==5.7.0
urllib3==1.26.19
uvicorn==0.21.1
Expand Down