Skip to content

Commit

Permalink
update packages and simplify start command
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammad.mamun committed Oct 26, 2023
1 parent 364d152 commit 41fd6bd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#base image
FROM python:3.8.6-slim-buster
FROM python:3.10-slim-buster

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
## FastAPI MicroService with Docker, Nginx and MongoDB(Motor)

### Create [virtual environment](https://docs.python.org/3/library/venv.html) and install requirements
```sh
pip install -r requirements.txt
```

### Installation Instruction
- Create [virtual environment](https://docs.python.org/3/library/venv.html) and install requirements
```sh
pip install -r requirements.txt
```
- Copy .env.example as .env
```sh
cp .env.example .env
```
### Run docker compose
- Make sure [docker](https://docs.docker.com/engine/install) and [docker-compose](https://docs.docker.com/compose/install/) installed

### Lets Run
### Lets Run with Docker
- Docker run `sudo docker-compose up -d --build`
- Locally run `uvicorn src.servers.start:app --reload`

### Lets Run Locally
- Locally run `uvicorn server:app --reload`
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
container_name: service
build: .
restart: always
command: gunicorn -w 4 -k uvicorn.workers.UvicornWorker src.servers.start:app --bind 0.0.0.0:8000
command: gunicorn -w 4 -k uvicorn.workers.UvicornWorker server:app --bind 0.0.0.0:8000
expose:
- 8000
# env_file:
Expand Down
9 changes: 4 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
fastapi==0.66.0
uvicorn==0.14.0
motor==2.4.0
python-dotenv==0.18.0
gunicorn==20.1.0
fastapi==0.104.0
uvicorn==0.23.2
motor==3.3.1
python-dotenv==1.0.0
File renamed without changes.

0 comments on commit 41fd6bd

Please sign in to comment.