FROM python:3.8.6

RUN mkdir -p /opt/backend

ENV PORT 80

EXPOSE $PORT/tcp

STOPSIGNAL SIGINT

# Install gmpy2, should make it faster.
RUN apt-get update; apt-get install python3-gmpy2 libssl-dev libffi-dev -y

WORKDIR /opt/backend

COPY requirements.txt .

RUN pip --disable-pip-version-check install -r requirements.txt

COPY . .

# For Local development only.
CMD ["uvicorn", "--reload", "--log-level", "trace", "backend:app", "--port", "80", "--host", "0.0.0.0"]

# CMD exec uvicorn backend:app --port $PORT --host 0.0.0.0
# CMD exec uvicorn --log-level trace --reload backend:app --port $PORT --host 0.0.0.0


# For Production lookinto https://www.uvicorn.org/deployment/#gunicorn.

