FROM  python:3.11.5-slim-bullseye
ENV PYTHONUNBUFFERED=1

COPY ./wheels /wheels
WORKDIR /mamba-backend
COPY . /tmp/barapplication
COPY ./requirements.txt .

# copy from the current directory of the Dockerfile to /mamba-backend in the image

RUN pip install --no-index --find-links=/wheels --only-binary '*' -r requirements.txt
RUN pip install --no-index --find-links=/wheels /tmp/barapplication


ADD barapplication/demo-fixture.json /mamba-backend/demo-fixture.json
ADD ./barapplication/manage.py /mamba-backend/manage.py
COPY ./entrypoint.sh /mamba-backend/entrypoint.sh
RUN sed -i 's/\r//' /mamba-backend/entrypoint.sh
RUN chmod +x /mamba-backend/entrypoint.sh
RUN chown nobody /mamba-backend/entrypoint.sh

COPY barapplication/static /var/static

ENV DJANGO_SETTINGS_MODULE=barapplication.settings
VOLUME ["/usr/share/nginx/html/static"]

CMD ["bash", "/mamba-backend/entrypoint.sh"]

EXPOSE 8080