Flask now runs on Gunicorn, and runs through NGinx

This commit is contained in:
2025-01-22 00:55:18 +00:00
parent 043effb6db
commit ca33ca6b70
6 changed files with 13 additions and 13 deletions

View File

@@ -7,13 +7,13 @@ services:
- "1935:1935" # RTMP - "1935:1935" # RTMP
- "8080:8080" - "8080:8080"
depends_on: depends_on:
- flask - app
networks: networks:
- app_network - app_network
flask: app:
build: build:
context: ./web_server context: ./app
ports: ports:
- "5000:5000" - "5000:5000"
networks: networks:
@@ -21,3 +21,4 @@ services:
networks: networks:
app_network: app_network:
driver: bridge

View File

@@ -32,12 +32,14 @@ http {
application/vnd.apple.mpegurl m3u8; application/vnd.apple.mpegurl m3u8;
video/mp2t ts; video/mp2t ts;
} }
}
root /tmp; location / {
add_header Cache-Control no-cache; proxy_pass http://127.0.0.1:5000; # flask-app is the name of the Flask container in docker-compose
add_header Access-Control-Allow-Origin *; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
autoindex on; # Enable directory indexing proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
} }
} }
} }

View File

@@ -14,8 +14,5 @@ COPY . .
ENV FLASK_APP=blueprints.__init__ ENV FLASK_APP=blueprints.__init__
ENV FLASK_DEBUG=True ENV FLASK_DEBUG=True
# Expose Flask's port
EXPOSE 5000
# Start the Flask app # Start the Flask app
CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"] CMD ["gunicorn", "-b", "0.0.0.0:5000", "blueprints.__init__:create_app()"]

View File

@@ -1 +0,0 @@
flask

View File

@@ -18,3 +18,4 @@ typing_extensions==4.12.2
urllib3==2.3.0 urllib3==2.3.0
Werkzeug==3.1.3 Werkzeug==3.1.3
WTForms==3.2.1 WTForms==3.2.1
Gunicorn==20.1.0