build(docker): compile backend trasnlations during image build
This commit is contained in:
parent
6657000d89
commit
99755ac611
|
|
@ -145,6 +145,9 @@ ENV PATH=/root/.local/bin:$PATH
|
|||
COPY --from=builder_stage ${INVENTREE_BACKEND_DIR}/InvenTree/web/static/web ${INVENTREE_BACKEND_DIR}/InvenTree/web/static/web
|
||||
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"
|
||||
|
||||
# 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"]
|
||||
|
||||
|
|
|
|||
18
tasks.py
18
tasks.py
|
|
@ -906,6 +906,23 @@ def backend_trans(c, verbose: bool = False):
|
|||
success('Backend translations compiled successfully')
|
||||
|
||||
|
||||
@task(help={'verbose': 'Print verbose output'})
|
||||
@state_logger('backend_compilemessages')
|
||||
def backend_compilemessages(c, verbose: bool = False):
|
||||
"""Compile backend Django translation files without loading InvenTree settings."""
|
||||
info('Compiling backend translations...')
|
||||
|
||||
cmd = 'python3 -m django compilemessages'
|
||||
|
||||
if verbose:
|
||||
cmd += ' -v 1'
|
||||
else:
|
||||
cmd += ' -v 0'
|
||||
|
||||
run(c, cmd, manage_py_dir())
|
||||
success('Backend translations compiled successfully')
|
||||
|
||||
|
||||
@task(
|
||||
help={
|
||||
'clean': 'Clean up old backup files',
|
||||
|
|
@ -2490,6 +2507,7 @@ internal = Collection(
|
|||
clear_generated,
|
||||
export_settings_definitions,
|
||||
export_definitions,
|
||||
backend_compilemessages,
|
||||
frontend_build,
|
||||
frontend_check,
|
||||
frontend_compile,
|
||||
|
|
|
|||
Loading…
Reference in New Issue