sec: add production server

This commit is contained in:
2025-08-07 21:16:47 +03:00
committed by Sweetbread
parent cfd81884db
commit e6ba705862
3 changed files with 21 additions and 8 deletions
+16 -7
View File
@@ -1,14 +1,23 @@
FROM python:3.11-slim FROM node:18-alpine as sass
RUN apt-get update && apt-get install -y curl && \ RUN NODE_OPTIONS=--dns-result-order=ipv4first npm install -g sass
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ WORKDIR /build
apt-get install -y nodejs && \ COPY ./static/style ./style
NODE_OPTIONS=--dns-result-order=ipv4first npm install -g sass && \ RUN sass ./style:./style \
apt-get clean && rm -rf /var/lib/apt/lists/* --no-source-map \
--style=compressed
FROM python:3.11-slim
WORKDIR /app WORKDIR /app
COPY . . COPY . .
COPY --from=sass /build/style/ ./static/style/
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
CMD flask run --host 0.0.0.0 ENV FLASK_ENV=production
ENV PYTHONUNBUFFERED=1
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:80", "--workers", "4"]
+3 -1
View File
@@ -2,7 +2,9 @@ from os import system as console
from flask import Flask, render_template from flask import Flask, render_template
app = Flask(__name__) app = Flask(__name__)
console("sass static/style/main.scss static/style/main.css")
if app.debug:
console("sass static/style/main.scss static/style/main.css")
@app.route("/") @app.route("/")
def index(): def index():
+2
View File
@@ -1 +1,3 @@
Flask==3.1.1 Flask==3.1.1
gunicorn