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
9 changes: 9 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
__pycache__/
*.pyc
*.pyo
*.pyd
data.db
migrations/
.env
.flaskenv
.git
20 changes: 20 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM python:3.11-slim

ENV PYTHONUNBUFFERED=1

WORKDIR /app

# RUN apt-get update && apt-get install -y \
# gcc \
# libpq-dev \
# && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .

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

COPY . .

EXPOSE 5000

CMD ["python", "application.py"]
11 changes: 11 additions & 0 deletions backend/application.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
from flaskr import create_app

app = create_app()

# for rule in app.url_map.iter_rules():
# print(rule)

@app.route("/")
def index():
return {"message": "Welcome to Todo App API"}

if __name__ == "__main__":
# 0.0.0.0 makes Flask accessible outside the container
app.run(host="0.0.0.0", port=5000, debug=True)
29 changes: 29 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: "3.9"

services:
backend:
build:
context: ./backend
container_name: flask-backend
ports:
- "5000:5000"
volumes:
- ./backend:/app
environment:
FLASK_ENV: development
JWT_SECRET_KEY: super-secret
SECRET_KEY: super-secret
restart: always

frontend:
build:
context: ./frontend
container_name: react-frontend
ports:
- "5173:5173"
volumes:
- ./frontend:/app
- /app/node_modules
depends_on:
- backend
restart: always
3 changes: 3 additions & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
.git
13 changes: 13 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:20

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 5173

CMD [ "npm", "run", "dev", "--", "--host" ]