change Dockerfile to use gunicorn, requiring some changes to the app.

pull/23/head
root 2 years ago
parent c14625b26e
commit 5c57120097

@ -1,8 +1,11 @@
FROM tensorflow/tensorflow:2.5.0
WORKDIR /app
COPY requirements.txt /app
RUN mkdir -p /app/data && pip install -r /app/requirements.txt
ENV PASTEY_WORKERS=2
ENV PASTEY_THREADS=4
ENV PASTEY_LISTEN_PORT=5000
RUN pip install gunicorn
COPY requirements.txt /app/
RUN pip install -r /app/requirements.txt
COPY . /app/
EXPOSE 5000
ENV PASTEY_DATA_DIRECTORY=/app/data
ENTRYPOINT ["python3", "app.py"]
WORKDIR /app
ENTRYPOINT ["sh", "-c", "gunicorn -w $PASTEY_WORKERS -t $PASTEY_THREADS -b :$PASTEY_LISTEN_PORT app:app"]
EXPOSE $PASTEY_LISTEN_PORT

@ -1,5 +1,8 @@
from . import config
from __main__ import guess
if __name__ == '__main__':
from __main__ import guess
else:
from app import guess
import ipaddress
from os import path
from pathlib import Path
@ -104,4 +107,4 @@ def build_url(request, path="/"):
else:
protocol = request.url.split('//')[0] if not config.force_https_links else "https:"
return protocol + "//" + domain + path
return protocol + "//" + domain + path

@ -1,4 +1,7 @@
from __main__ import guess, app
if __name__ == '__main__':
from __main__ import guess, app
else:
from app import guess, app
from . import config, common
from os import path, remove

@ -1,4 +1,7 @@
from __main__ import app, limiter, loaded_config
if __name__ == '__main__':
from __main__ import app, limiter, loaded_config
else:
from app import app, limiter, loaded_config
from . import config, common, functions
from flask import Flask, render_template, request, redirect, abort, make_response

Loading…
Cancel
Save