# pull official base image FROM python:3.8-slim-buster # set work directory WORKDIR /usr/src/app # set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # copy requirements and wheelhouse first (for caching) COPY requirements.txt . COPY wheelhouse/ ./wheelhouse/ # install system dependencies RUN apt-get update && \ apt-get install -y gcc pkg-config default-libmysqlclient-dev python3-dev vim systemd && \ apt-get clean # install Python dependencies from .whl RUN pip install --upgrade pip && \ pip install --no-index --find-links=wheelhouse -r requirements.txt # copy actual project source code COPY . /usr/src/app/ # collect static files RUN python manage.py collectstatic --noinput # expose the port EXPOSE 8000 # run using gunicorn CMD ["gunicorn", "--workers=3", "--bind=0.0.0.0:8000", "drf_prj.wsgi:application"]