Skip to content

Commit

Permalink
use uWSGI as production server
Browse files Browse the repository at this point in the history
  • Loading branch information
Waujito committed Mar 16, 2024
1 parent cdb1d98 commit d4a35d3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
19 changes: 16 additions & 3 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ARG DEBIAN_FRONTEND=noninteractive

RUN apt update -y && apt upgrade -y



FROM env as build

WORKDIR /app/
Expand All @@ -23,16 +25,27 @@ RUN mkdir /prj

RUN cp dist/$(ls dist | head -1) /prj/



FROM python:3.11-alpine as prod

RUN pip install waitress
RUN pip install pyuwsgi

RUN mkdir /prj
COPY --from=bulid /prj/* /prj/
COPY --from=build /prj/* /prj/

RUN pip install /prj/$(ls /prj)

ENTRYPOINT [ "waitress-serve", "--call", "flaskr:create_app" ]
COPY uwsgi.ini .



ENTRYPOINT [ "uwsgi", "uwsgi.ini"]






FROM env as dev
RUN conda create -n cenv python=3.11
Expand Down
9 changes: 9 additions & 0 deletions api/uwsgi.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[uwsgi]
module = flaskr:app
processes = 4
threads=2
master = 1
socket = 0.0.0.0:3031
http = 0.0.0.0:80
stats = 0.0.0.0:9191
stats-http = 1

0 comments on commit d4a35d3

Please sign in to comment.