Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9d1ff7b

Browse files
authored
Merge pull request #22 from getmoin/main
Updated application with Dockerfile and latest requirements versions
2 parents 5289c14 + f642d02 commit 9d1ff7b

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

‎Dockerfile‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM python:3.10-slim
2+
WORKDIR /app
3+
COPY requirements.txt .
4+
RUN pip install --no-cache-dir -r requirements.txt
5+
COPY . .
6+
EXPOSE 8000
7+
RUN touch /app/users.db
8+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ cd SimpleFastPyAPI
2121
Install the project dependencies:
2222

2323
```bash
24-
pip install -r requirements.txt
24+
docker build -t SimpleFastPyAPI .
2525
```
2626

2727
Run the application:
2828

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

3333
The application will start and be available at http://localhost:8000.

‎app/database.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from sqlalchemy import create_engine
22
from sqlalchemy.orm import sessionmaker
33

4-
5-
DATABASE_URL = "sqlite:///../users.db"
4+
DATABASE_URL = "sqlite:///./users.db"
65

76
engine = create_engine(DATABASE_URL)
87

‎requirements.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ requests==2.32.0
2626
rfc3986==1.5.0
2727
sniffio==1.3.0
2828
SQLAlchemy==1.4.47
29-
starlette==0.40.0
29+
starlette==0.35.0
3030
typing==3.7.4.3
31-
typing_extensions==4.5.0
31+
typing_extensions==4.8.0
3232
ujson==5.7.0
3333
urllib3==1.26.19
3434
uvicorn==0.21.1

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /