mirror of
https://github.com/inventree/InvenTree.git
synced 2026-08-10 07:26:14 +00:00
[docker] Include pip license file (#12583)
* [docker] Include pip license file This file has been missing in production builds * Add CI test * Update contrib/container/Dockerfile Co-authored-by: Matthias Mair <code@mjmair.com> * Fix typo * path fix * More pathing fixes --------- Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
@@ -84,6 +84,9 @@ jobs:
|
||||
docker run --rm inventree-test test -f /home/inventree/gunicorn.conf.py
|
||||
docker run --rm inventree-test test -f /home/inventree/src/backend/requirements.txt
|
||||
docker run --rm inventree-test test -f /home/inventree/src/backend/InvenTree/manage.py
|
||||
# Check that license information was generated into the image
|
||||
docker run --rm inventree-test test -s /home/inventree/src/backend/InvenTree/InvenTree/licenses.txt
|
||||
docker run --rm inventree-test test -s /home/inventree/src/backend/InvenTree/web/static/web/.vite/dependencies.json
|
||||
# Check that backend translations were compiled into the image (a few representative languages)
|
||||
docker run --rm inventree-test test -f /home/inventree/src/backend/InvenTree/locale/de/LC_MESSAGES/django.mo
|
||||
docker run --rm inventree-test test -f /home/inventree/src/backend/InvenTree/locale/fr/LC_MESSAGES/django.mo
|
||||
|
||||
@@ -149,6 +149,10 @@ COPY --from=builder_stage /root/.local /root/.local
|
||||
# Compile Django backend translations during image build
|
||||
RUN bash -c "cd '${INVENTREE_HOME}' && invoke int.backend-compilemessages"
|
||||
|
||||
# Generate license information for installed python packages
|
||||
RUN pip-licenses --format=json --with-license-file --no-license-path > "${INVENTREE_BACKEND_DIR}/InvenTree/InvenTree/licenses.txt" \
|
||||
&& test -s "${INVENTREE_BACKEND_DIR}/InvenTree/InvenTree/licenses.txt"
|
||||
|
||||
# Launch the production server
|
||||
CMD ["sh", "-c", "exec gunicorn -c ./gunicorn.conf.py InvenTree.wsgi -b ${INVENTREE_WEB_ADDR}:${INVENTREE_WEB_PORT} --chdir ${INVENTREE_BACKEND_DIR}/InvenTree"]
|
||||
|
||||
|
||||
@@ -764,6 +764,9 @@ def install(
|
||||
f'pip-licenses --format=json --with-license-file --no-license-path > {lic_path}',
|
||||
)
|
||||
|
||||
if not lic_path.exists() or lic_path.stat().st_size == 0:
|
||||
raise FileNotFoundError(f"License file was not generated at '{lic_path}'")
|
||||
|
||||
success('Dependency installation complete')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user