Skip to content
Open
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pycache__/
venv
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.11-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 8000

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ENVIRONMENT_VARS_FILE := .env

up:
docker compose up

down:
docker compose down

logs:
docker-compose logs -f

clean:
docker compose down --rmi all -v
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,50 @@ Good next steps once you are comfortable with this project:

---

## Quick Setup Guide

Follow these quick steps to get the project running using the provided `Makefile` (Docker-based).

Prerequisites:

- Install Docker and Docker Compose for your platform.
- Install make using chocolatey

```bash
choco install make
```
Create `.env` file then add these variables

```bash
DB_USER=
DB_PASS=
DB_NAME=
```

Start the app (Docker):

```bash
make up
```

Stop the app:

```bash
make down
```

View container logs:

```bash
make logs
```

Remove containers, images and volumes (clean):

```bash
make clean
```

## License

MIT - free to use, modify, and share.
38 changes: 38 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: task_manager
services:
app:
container_name: task_manager_app
build: .
depends_on:
- db
ports:
- "8000:8000"
environment:
DATABASE_URL: "postgres://${DB_USER}:${DB_PASS}@postgres:5432/${DB_NAME}"
env_file:
- .env
develop:
watch:
- path: .
include: "*.py"
action: rebuild

db:
image: postgres:16
container_name: task_manager_db
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASS}
env_file:
- .env
ports:
- "5432:5432"
volumes:
- postgres-db:/var/lib/postgresql/data

volumes:
postgres-db:
driver: local



3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fastapi
sqlalchemy
uvicorn