mirror of
https://github.com/dnlbauer/pdfact-service.git
synced 2026-09-10 14:15:30 +00:00
run app with gunicorn
This commit is contained in:
14
Dockerfile
14
Dockerfile
@@ -1,14 +1,17 @@
|
||||
# build pdfact
|
||||
# STEP 1: build pdfact
|
||||
FROM ubuntu:20.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y maven git
|
||||
|
||||
WORKDIR /
|
||||
# TODO freeze revision?
|
||||
RUN git clone https://github.com/ad-freiburg/pdfact.git
|
||||
WORKDIR pdfact
|
||||
|
||||
RUN mvn install -DskipTests
|
||||
|
||||
# STEP 2: run service
|
||||
FROM alpine:latest
|
||||
WORKDIR /
|
||||
|
||||
@@ -26,12 +29,15 @@ RUN apk add --no-cache python3 \
|
||||
&& python3 -m ensurepip \
|
||||
&& pip3 install --upgrade pip setuptools
|
||||
|
||||
# set environment variables
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
# install flask app
|
||||
WORKDIR /app
|
||||
COPY ./requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY app.py .
|
||||
ENTRYPOINT ["python3"]
|
||||
CMD ["app.py"]
|
||||
COPY app.py gunicorn.conf.py ./
|
||||
|
||||
ENTRYPOINT ["gunicorn", "--conf", "gunicorn.conf.py", "--bind", "0.0.0.0:80", "app:app"]
|
||||
|
||||
8
gunicorn.conf.py
Normal file
8
gunicorn.conf.py
Normal file
@@ -0,0 +1,8 @@
|
||||
loglevel = "info"
|
||||
errorlog = "-" # stderr
|
||||
accesslog = "-" # stdout
|
||||
worker_tmp_dir = "/dev/shm"
|
||||
graceful_timeout = 120
|
||||
timeout = 120
|
||||
keepalive = 5
|
||||
threads = 4
|
||||
@@ -1 +1,2 @@
|
||||
Flask==2.2.2
|
||||
Flask==2.2.2
|
||||
gunicorn==20.1.0
|
||||
Reference in New Issue
Block a user