FROM python:3.11-slim-buster

RUN pip install --no-cache-dir gunicorn

WORKDIR /rifalto
COPY requirements.txt /rifalto
RUN pip install --no-cache-dir -r requirements.txt
RUN rm requirements.txt

EXPOSE 5000

COPY rifaserver ./rifaserver
COPY start.sh .
COPY migrations ./migrations

RUN chmod +x start.sh
ENV FLASK_APP=rifaserver.app
ENV PYTHONUNBUFFERED 1
# CMD ["gunicorn", "-b", ":5000", "rifaserver.app:app", "--access-logfile", "-", "--error-logfile", "-"]
#    "--access-logformat", "%({x-forwarded-for}i)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\""]
CMD ["./start.sh"]
