FROM python:3.7-alpine as base

FROM base as builder

RUN mkdir /install
WORKDIR /install

COPY req.txt /requirements.txt

RUN pip install --install-option="--prefix=/install" -r /requirements.txt

FROM base

COPY --from=builder /install /usr/local

COPY ./app.py /app/app.py
COPY ./data.json /app/data.json

COPY ./templates /app/templates

COPY ./static /app/static

COPY ./data /app/data

WORKDIR /app

EXPOSE 8000

CMD ["gunicorn", "-w 4", "-b 0.0.0.0", "app:app"]