FROM docker.io/python:slim RUN bash -c 'mkdir /app;\ python -m venv /venv;\ useradd -r app;\ chown app: -R /app;\ chown app: -R /venv;' WORKDIR /app USER app COPY requirements.txt /app/ RUN /venv/bin/pip install -r requirements.txt COPY --chown=app: static /app/static COPY templates /app/templates COPY wg_manager /app/wg_manager COPY wg_connection_manager /app/wg_connection_manager COPY requirements.txt .env manage.py /app/ RUN bash -c '/venv/bin/python manage.py migrate ; \ /venv/bin/python manage.py collectstatic --noinput;\ /venv/bin/python manage.py ensure_adminuser --password admin' EXPOSE 4000 CMD ["/venv/bin/gunicorn","wg_manager.wsgi","-b0.0.0.0:4000"]