FROM python:3.11-alpine3.18 AS requirements

WORKDIR /workdir

RUN pip --no-cache-dir install poetry

COPY poetry.lock pyproject.toml /workdir/
RUN poetry export -f requirements.txt -o /requirements.txt


FROM python:3.11-alpine3.18

ENV PORT=8000

WORKDIR /app

RUN pip --no-cache-dir install gunicorn

COPY --from=requirements /requirements.txt /app/
RUN pip --no-cache-dir install -r requirements.txt

COPY LICENSE manage.py /app/
COPY ljg /app/ljg/
COPY docker/entrypoint.sh /

EXPOSE 8000

ENTRYPOINT ["/entrypoint.sh"]
