Skip to content

Commit 210b727

Browse files
Merge PR 828
2 parents d448a0b + fb38107 commit 210b727

7 files changed

Lines changed: 60 additions & 7 deletions

File tree

‎Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM python:3.11-slim
44
# Set environment variables
55
ENV PYTHONDONTWRITEBYTECODE=1
66
ENV PYTHONUNBUFFERED=1
7-
ENV FLASK_APP=app.py
7+
ENV FLASK_APP=backend/app.py
88
ENV FLASK_HOST=0.0.0.0
99
ENV PORT=5000
1010

@@ -28,4 +28,4 @@ COPY . .
2828
EXPOSE 5000
2929

3030
# Run the application
31-
CMD ["python", "app.py"]
31+
CMD ["python", "backend/app.py"]

‎Dockerfile.frontend‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM nginx:alpine
2+
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
3+
COPY ./frontend /usr/share/nginx/html
4+
EXPOSE 80
5+
CMD ["nginx", "-g", "daemon off;"]

‎backend/app.py‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Flask backend application with GoodReads mood analysis integration
22
# Initialize Flask app, configure CORS, and setup mood analysis endpoints
33

4+
import sys
5+
import os
6+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
7+
48
from flask import Flask, request, jsonify, redirect, url_for
59
from flask_cors import CORS
610
from flask_jwt_extended import (
@@ -25,11 +29,8 @@
2529

2630
import logging
2731
from datetime import datetime, timedelta, timezone
28-
import sys
29-
import os
30-
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
31-
from backend.sanitizer import sanitize_payload
32-
from backend.reader_identity.routes import reader_identity_bp
32+
from sanitizer import sanitize_payload
33+
from reader_identity.routes import reader_identity_bp
3334

3435
# Load environment variables from config directory based on APP_ENV
3536
env = os.getenv('APP_ENV', 'development')

‎docker-compose.override.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
frontend:
3+
volumes:
4+
- ./frontend:/usr/share/nginx/html
5+
- ./nginx.conf:/etc/nginx/conf.d/default.conf
6+
7+
app:
8+
volumes:
9+
- .:/app
10+
environment:
11+
- FLASK_DEBUG=True
12+
- APP_ENV=development

‎docker-compose.yml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
services:
2+
frontend:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile.frontend
6+
ports:
7+
- "80:80"
8+
depends_on:
9+
- app
10+
restart: always
11+
212
app:
313
build: .
414
ports:

‎nginx.conf‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
5+
root /usr/share/nginx/html;
6+
index index.html;
7+
8+
location = / {
9+
return 301 /pages/index.html;
10+
}
11+
12+
location / {
13+
try_files $uri $uri/ =404;
14+
}
15+
16+
location /api/ {
17+
proxy_pass http://app:5000;
18+
proxy_set_header Host $host;
19+
proxy_set_header X-Real-IP $remote_addr;
20+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
21+
proxy_set_header X-Forwarded-Proto $scheme;
22+
}
23+
}

‎requirements.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,5 @@ Werkzeug==3.1.5
6565
greenlet==3.3.1
6666
blinker==1.9.0
6767
typing_extensions==4.15.0
68+
Pillow>=10.0.0
69+
sentence-transformers>=2.2.2

0 commit comments

Comments
 (0)