# Use the official lightweight Python image.
# https://hub.docker.com/_/python
FROM python:3.11-slim

# install tools
RUN apt-get update 
RUN apt-get install -y --no-install-recommends git 
RUN apt-get install -y dos2unix
RUN apt-get install -y python3-dev build-essential
RUN apt-get install -y curl
RUN apt-get purge -y --auto-remove && rm -rf /var/lib/apt/lists/*

ENV APP_HOME /app
ENV PYTHONUNBUFFERED=1

RUN mkdir /app
WORKDIR $APP_HOME

COPY requirements.txt .
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

# fix issue with windows CRLF
RUN dos2unix /app/*.sh

CMD exec gunicorn --bind 0.0.0.0:$PORT --workers 1 --threads 8 --timeout 0 job.wsgi:application
