FROM python:3.8.14-alpine3.16 AS backend ENV PYTHONUNBUFFERED 1 WORKDIR /code RUN apk --update --no-cache add \ "libpq~=14" \ "libxslt~=1.1" \ "nodejs-current~=18" \ "xmlsec~=1.2" COPY requirements.txt ./ COPY requirements ./requirements RUN apk --update --no-cache --virtual .build-deps add \ "bash~=5.1" \ "g++~=11.2" \ "gcc~=11.2" \ "cargo~=1.60" \ "git~=2" \ "make~=4.3" \ "libffi-dev~=3.4" \ "libxml2-dev~=2.9" \ "libxslt-dev~=1.1" \ "xmlsec-dev~=1.2" \ "postgresql13-dev~=13" \ "libmaxminddb~=1.6" \ && \ pip install -r requirements.txt --compile --no-cache-dir \ && \ apk del .build-deps RUN addgroup -S plane && \ adduser -S captain -G plane RUN chown captain.plane /code USER captain # Add in Django deps and generate Django's static files COPY manage.py manage.py COPY plane plane/ COPY templates templates/ COPY gunicorn.config.py ./ COPY bin/takeoff ./takeoff USER captain # Expose container port and run entry point script EXPOSE 8000 # ENTRYPOINT [ "./takeoff" ] CMD python manage.py migrate && python manage.py rqworker & exec gunicorn plane.wsgi -k gthread --workers 8 --bind 0.0.0.0:8000 --config gunicorn.config.py --max-requests 10000 --max-requests-jitter 1000 --access-logfile -