# InvenTree Cloudron Package
#
# InvenTree is an open-source inventory management system (Django):
# parts/stock tracking, BOMs, suppliers, purchase orders, build orders,
# plugin ecosystem. PostgreSQL storage + Redis for background-task
# queues (RQ) and optional caching.
#
# Upstream: https://github.com/inventree/InvenTree (MIT), v1.5.2.
#   - Official image inventree/inventree (single image; upstream compose
#     runs inventree-server [gunicorn :8000] and inventree-worker
#     [invoke worker] as separate services - Cloudron is one container,
#     so start.sh backgrounds the worker gated on the web port, the
#     same pattern as NetBox).
#   - Everything is env-configurable via INVENTREE_* (config.md): DB,
#     cache, site URL, secret key, admin seed, SOCIAL_PROVIDERS JSON.
#   - The image ENTRYPOINT (init.sh) prepares dirs + config template
#     and execs the CMD; migrations/static collection run via
#     `invoke update`, which start.sh drives explicitly.
#
# Authentication: NATIVE OIDC (preferred) via django-allauth
# (settings.py:1002 reads INVENTREE_SOCIAL_PROVIDERS;
# SOCIALACCOUNT_OPENID_CONNECT_URL_PREFIX='' so SSO routes live at
# /accounts/oidc/...). start.sh builds the provider JSON from the
# Cloudron platform OIDC env (CLOUDRON_OIDC_*). LDAP also exists in
# core (INVENTREE_LDAP_ENABLED) as an alternative. Local login remains;
# the first admin is seeded (generated password, see README).
#
# Pattern: official-image wrapper. Image pinned by tag AND digest
# (amd64 manifest digest of 1.5.2, from docker manifest inspect).
FROM inventree/inventree:1.5.2@sha256:2df695b338b9fbcb4d86a6a3c27c5f53e690d1b58af8a216e69fec49fc178a14

# no packages needed: the image ships bash, python, invoke; start.sh
# only orchestrates env + processes
COPY start.sh /app/start.sh

# gunicorn web server; API/SSO all on this port (worker has no listener)
EXPOSE 8000

ENTRYPOINT ["/bin/bash", "/app/start.sh"]
