From 813c3df402843bf5de141b59c90d8bc78c76601b Mon Sep 17 00:00:00 2001 From: Pablo Panero Date: Thu, 19 Mar 2020 18:26:37 +0100 Subject: [PATCH 1/3] docker: add alt assets inclusion during build --- {{cookiecutter.project_shortname}}/Dockerfile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_shortname}}/Dockerfile b/{{cookiecutter.project_shortname}}/Dockerfile index dec233e..5faa98d 100644 --- a/{{cookiecutter.project_shortname}}/Dockerfile +++ b/{{cookiecutter.project_shortname}}/Dockerfile @@ -20,12 +20,25 @@ FROM inveniosoftware/centos7-python:3.6 +ARG include_assets + COPY Pipfile Pipfile.lock ./ RUN pipenv install --deploy --system +COPY ./ . COPY ./docker/uwsgi/ ${INVENIO_INSTANCE_PATH} COPY ./invenio.cfg ${INVENIO_INSTANCE_PATH} COPY ./templates/ ${INVENIO_INSTANCE_PATH}/templates/ -COPY ./ . + +RUN if [ "$include_assets" = "true" ]; \ + then \ + cp -r ./static/. ${INVENIO_INSTANCE_PATH}/static/ && \ + cp -r ./assets/. ${INVENIO_INSTANCE_PATH}/assets/ && \ + invenio collect --verbose && \ + invenio webpack create && \ + # --unsafe needed because we are running as root + invenio webpack install --unsafe && \ + invenio webpack build \ + ; fi ENTRYPOINT [ "bash", "-c"] From 2ebcf5f456f8155e413e71c7a64147469c2697a8 Mon Sep 17 00:00:00 2001 From: Pablo Panero Date: Mon, 23 Mar 2020 15:30:44 +0100 Subject: [PATCH 2/3] dockerfile: caching and commands improvements Co-authored-by: Guillaume Viger --- {{cookiecutter.project_shortname}}/Dockerfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/{{cookiecutter.project_shortname}}/Dockerfile b/{{cookiecutter.project_shortname}}/Dockerfile index 5faa98d..c29bc47 100644 --- a/{{cookiecutter.project_shortname}}/Dockerfile +++ b/{{cookiecutter.project_shortname}}/Dockerfile @@ -25,20 +25,17 @@ ARG include_assets COPY Pipfile Pipfile.lock ./ RUN pipenv install --deploy --system -COPY ./ . COPY ./docker/uwsgi/ ${INVENIO_INSTANCE_PATH} COPY ./invenio.cfg ${INVENIO_INSTANCE_PATH} COPY ./templates/ ${INVENIO_INSTANCE_PATH}/templates/ +COPY ./ . RUN if [ "$include_assets" = "true" ]; \ then \ cp -r ./static/. ${INVENIO_INSTANCE_PATH}/static/ && \ cp -r ./assets/. ${INVENIO_INSTANCE_PATH}/assets/ && \ invenio collect --verbose && \ - invenio webpack create && \ - # --unsafe needed because we are running as root - invenio webpack install --unsafe && \ - invenio webpack build \ + invenio webpack buildall \ ; fi ENTRYPOINT [ "bash", "-c"] From 195d30b5318d18218a501ac575f46bd80c562a6d Mon Sep 17 00:00:00 2001 From: Pablo Panero Date: Mon, 23 Mar 2020 15:31:49 +0100 Subject: [PATCH 3/3] scripts: remove pre dependencies installation --- scripts/bootstrap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/bootstrap b/scripts/bootstrap index 9a71700..e975838 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -17,11 +17,11 @@ pipfile_lock_path="./Pipfile.lock" if [ ! -f $pipfile_lock_path ]; then echo "'Pipfile.lock' not found. Generating via 'pipenv lock --dev'..." - pipenv lock --dev --pre + pipenv lock --dev fi # Installs all packages specified in Pipfile.lock -pipenv sync --dev --pre +pipenv sync --dev # Build assets pipenv run invenio collect -v pipenv run invenio webpack buildall