-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dockerfile: remove bootstrap call #91
Conversation
f19e96d
to
c8f3f0c
Compare
|
||
RUN ./scripts/bootstrap | ||
RUN pipenv run pip install --upgrade marshmallow==2.16.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporary fixes a marshmallow error with DateTime
field
@@ -7,7 +7,6 @@ name = "pypi" | |||
Babel = ">=2.4.0" | |||
Flask-BabelEx = ">=0.9.3" | |||
invenio = { version = ">=3.1.0dev20181106", extras = ["base", "metadata", "{{ cookiecutter.database }}", "auth", {%- if cookiecutter.elasticsearch == "5" %} "elasticsearch5", {%- elif cookiecutter.elasticsearch == "6" %} "elasticsearch6" {%- endif %} ]} | |||
{{ cookiecutter.project_shortname }} = {editable = true, path = "."} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removes the final application from Pipfile, so that it can be installed in the final step after with the dependencies has been built.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the application is not installed anymore, this should be reflected in the scripts/bootstrap
, i.e. it should run pipenv run pip install -e .
after the pipenv install ...
|
||
USER ${USER_ID} | ||
|
||
RUN pipenv install --deploy --dev --pre |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The --pre
and --dev
flags are moved here as they are meant for a dev environment. #87
f5a620f
to
1ed800f
Compare
COPY ./docker/uwsgi/ ${INVENIO_INSTANCE_PATH} | ||
|
||
RUN pipenv install --deploy --dev | ||
RUN pipenv run pip install --upgrade marshmallow==2.16.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was an issue in case you do pipenv install --pre
which will include package pre-releases. Doing the following should be fine:
$ pipenv install marshmallow
...
$ pipenv run pip freeze
marshmallow==2.16.3
# vs.
$ pipenv install --pre marshmallow
...
$ pipenv run pip freeze
marshmallow==3.0.0rc1
|
||
_rabbit_check(){ docker-compose exec mq bash -c "rabbitmqctl status" &>/dev/null; } | ||
check_ready "RabbitMQ" _rabbit_check | ||
|
||
_web_server_check_css(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it enough to only wait for a valid HTTP response (as done below), since the assets are built before the server is actually started?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This covers the case where the link to the CSS file is there but returns 404.
In the webpack buildall
step, the docker build doesn't fail so it won't actually show
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't write under the comment above for some reason, (for marshmallow==2.16.3) this is indeed the case, we could remove the --pre
when invenio 3.1.0 is not in prerelease and this won't be needed, except if I'm missing a better way
@@ -0,0 +1,1650 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should be checking-in version control Pipfile.lock
for the cookiecutter. The purpose of the file is similar to what was done before when generating the requirements.txt
via pip-compile
. Probably something that should be added in the Invenio docs under "Getting started" -> "Next steps".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is to make the build faster, if you are installing the default configuration (e.g. db and es version) there's one less step, otherwise one would have to run it again as it is done in .travis.yml for the different environments, and this could be documented. If one follows the docs it would be ok, otherwise I see that it adds a complication. Generally this is recommended pypa/pipenv#598 https://pipenv.readthedocs.io/en/latest/basics/#pipfile-lock-security-features
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're correct (so let's keep the Pipfile.lock
), but for different reasons. Doing ./scripts/bootstrap
in the beginning runs pipenv install --dev --skip-lock
which is fast since it doesn't resolve and lock dependencies in Pipfile.lock
. The problem is that because of the lack of resolving dependencies it might produce a version-conflicted environment (which it actually does at the moment).
I would say that the correct practice would be to actually install dependencies from the Pipfile.lock
in bootstrap
, which is equivalent to the old way of first installing from requirements.txt
before starting to developing the application. This is not slow since it installs pinned dependencies, and produces as stable build. The command for this would be pipenv install --dev --ignore-pipfile
(or pipenv sync --dev
)
Upgrading dependencies should be a separate, conscious step that is initiated by the maintainer of the instance as part of its development process (and probably documented in the official docs)
66c3f5e
to
ae96a7f
Compare
ae96a7f
to
6186b39
Compare
@@ -1,7 +1,7 @@ | |||
{% include 'misc/header.py' %} | |||
FROM inveniosoftware/centos7-python:3.6 | |||
|
|||
COPY ./ . | |||
COPY Pipfile ./ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pipfile.lock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be generated in the RUN pipenv install --deploy
step
* Refactors last Dockerfile in the image building sequence to just copy the updated instance directory and run pip install, instead of running the bootstrap script again. Signed-off-by: Dinos Kousidis <dinos.kousidis@cern.ch>
* Adds Dockerfile.dev.base to install dev packages and pre releases. * Refactors Dockerfiles to create a first image containing the application dependencies, and a second one to install the application, and collect and build its assets with webpack. * Adds a Docker build process in run-tests.sh, to create the final instance image and bring up the container cluster from docker-compose.full.yml. Tests if web server is accessible with HTTP, HTTPS, and has loaded CSS. Signed-off-by: Dinos Kousidis <dinos.kousidis@cern.ch>
6186b39
to
497a7bc
Compare
Comments have been ticktized so merging |
copy the updated instance directory and run pip install, instead
of running the bootstrap script again.
Signed-off-by: Dinos Kousidis dinos.kousidis@cern.ch