Fix Docker build by downloading the models inside the image. Fix #504 (#516)

The data pipeline failed before because it tried downloading the model from
outside the Docker image and didn't had bugbug installed.

The clean way of solving this would be to build a base http service image on
release and build another one where we simply download the models but let's
fix it this way for now.
This commit is contained in:
Boris Feld 2019-05-29 20:43:58 +02:00 коммит произвёл Marco
Родитель 59e1d3a225
Коммит 6ee9fb57f0
4 изменённых файлов: 21 добавлений и 3 удалений

Просмотреть файл

@ -16,6 +16,6 @@ COPY ./models /code/models
ARG CHECK_MODELS
ENV CHECK_MODELS="${CHECK_MODELS}"
RUN python /code/bugbug_http_service/check_models.py
RUN bash /code/bugbug_http_service/ensure_models.sh
CMD gunicorn -b 0.0.0.0:$PORT bugbug_http_service.app --preload --timeout 30 -w 3

Просмотреть файл

@ -0,0 +1,20 @@
#!/bin/bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Download models and check that models can be correctly be loaded. Can be
# disabled by passing CHECK_MODELS=0 as an environment variable
set -eox pipefail
CURRENT_DIR=$(dirname "$0")
if [ "$CHECK_MODELS" == "0" ]; then
echo "Skipping downloading and checking models!"
exit 0;
fi
python "$CURRENT_DIR/download_models.py"
python "$CURRENT_DIR/check_models.py"

Просмотреть файл

@ -1,3 +1,2 @@
Flask==1.0.3
gunicorn==19.9.0

Просмотреть файл

@ -270,7 +270,6 @@ tasks:
- "git clone https://github.com/mozilla/bugbug /code &&
cd /code &&
git checkout master &&
python http_service/download_models.py &&
taskboot --target /code build-compose --registry=registry.hub.docker.com --write /images --service bugbug-http-service"
artifacts:
public/bugbug: