Skip to content

Commit

Permalink
Improve coach configuration
Browse files Browse the repository at this point in the history
Signed-off-by: ArthurTemporim <[email protected]>
  • Loading branch information
arthurTemporim committed Oct 21, 2019
1 parent 92a02d7 commit 1c3cb03
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 21 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ build:
make build-bot

build-requirements:
docker build . -f docker/requirements.Dockerfile -t lappis/botrequirements:boilerplate
docker build . -f docker/requirements.Dockerfile -t botrequirements

build-bot:
docker-compose build bot

build-coach:
docker-compose build coach
docker-compose up coach

build-analytics:
docker-compose up -d elasticsearch
Expand All @@ -30,7 +30,7 @@ build-analytics:
docker-compose run --rm -v $(current_dir)/modules/analytics/setup_elastic.py:/analytics/setup_elastic.py bot python /analytics/setup_elastic.py
docker-compose run --rm -v $(current_dir)/modules/analytics/:/analytics/ bot python /analytics/import_dashboards.py
echo "Não se esqueça de atualizar o arquivo endpoints.yml"
#sensible-browser --no-sandbox http://localhost:5601
sensible-browser --no-sandbox http://localhost:5601

run-analytics:
docker-compose up -d rabbitmq
Expand All @@ -54,7 +54,7 @@ run-notebooks:
sensible-browser --no-sandbox http://localhost:8888

train:
docker build . -f docker/coach.Dockerfile -t lappis/coach:boilerplate
docker-compose up coach
docker-compose build bot

validate:
Expand Down
2 changes: 1 addition & 1 deletion bot/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
############################## BOT ##############################
train:
rasa train -vv
rasa train -vv --out models/

shell:
rasa shell -m models/ -vv --endpoints endpoints.yml --port 5004 --cors "*"
Expand Down
9 changes: 7 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ services:
# =============================== Coach =================================
# All the models are trained by this coach.
coach:
image: lappis/coach:boilerplate
command: sh -c "cp -r /src_models/* "
build:
context: .
dockerfile: ./docker/coach.Dockerfile
volumes:
- ./bot/models/:/bot/models/
command: sh -c "make train"


# ================================= Bot =====================================
# Generic Rasa bot, used to run console for example.
Expand Down
2 changes: 1 addition & 1 deletion docker/actions.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM lappis/botrequirements:boilerplate
FROM botrequirements

COPY ./bot/actions/actions.py /bot/actions/actions.py
COPY ./bot/Makefile /bot/Makefile
Expand Down
6 changes: 1 addition & 5 deletions docker/bot.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
FROM lappis/coach:boilerplate as coach
FROM lappis/botrequirements:boilerplate
FROM botrequirements

WORKDIR /bot

COPY ./bot /bot
COPY ./modules /modules
COPY --from=coach /src_models/ /bot/models/

RUN chown -R 1001 /bot/models && chmod -R 750 /bot/models

RUN find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
10 changes: 3 additions & 7 deletions docker/coach.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
FROM lappis/botrequirements:boilerplate
FROM botrequirements as coach

COPY ./bot/ /coach/
WORKDIR /bot

RUN mkdir /src_models

WORKDIR /coach
COPY ./bot/ /bot/

RUN make train

RUN find /. | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
2 changes: 1 addition & 1 deletion docker/requirements.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.6-slim
FROM python:3.6-slim as botrequirements

RUN apt update && apt install -y gcc make

Expand Down

0 comments on commit 1c3cb03

Please sign in to comment.