Skip to content

Commit 1c3cb03

Browse files
Improve coach configuration
Signed-off-by: ArthurTemporim <[email protected]>
1 parent 92a02d7 commit 1c3cb03

File tree

7 files changed

+18
-21
lines changed

7 files changed

+18
-21
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ build:
1111
make build-bot
1212

1313
build-requirements:
14-
docker build . -f docker/requirements.Dockerfile -t lappis/botrequirements:boilerplate
14+
docker build . -f docker/requirements.Dockerfile -t botrequirements
1515

1616
build-bot:
1717
docker-compose build bot
1818

1919
build-coach:
20-
docker-compose build coach
20+
docker-compose up coach
2121

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

3535
run-analytics:
3636
docker-compose up -d rabbitmq
@@ -54,7 +54,7 @@ run-notebooks:
5454
sensible-browser --no-sandbox http://localhost:8888
5555

5656
train:
57-
docker build . -f docker/coach.Dockerfile -t lappis/coach:boilerplate
57+
docker-compose up coach
5858
docker-compose build bot
5959

6060
validate:

bot/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
############################## BOT ##############################
22
train:
3-
rasa train -vv
3+
rasa train -vv --out models/
44

55
shell:
66
rasa shell -m models/ -vv --endpoints endpoints.yml --port 5004 --cors "*"

docker-compose.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ services:
44
# =============================== Coach =================================
55
# All the models are trained by this coach.
66
coach:
7-
image: lappis/coach:boilerplate
8-
command: sh -c "cp -r /src_models/* "
7+
build:
8+
context: .
9+
dockerfile: ./docker/coach.Dockerfile
10+
volumes:
11+
- ./bot/models/:/bot/models/
12+
command: sh -c "make train"
13+
914

1015
# ================================= Bot =====================================
1116
# Generic Rasa bot, used to run console for example.

docker/actions.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM lappis/botrequirements:boilerplate
1+
FROM botrequirements
22

33
COPY ./bot/actions/actions.py /bot/actions/actions.py
44
COPY ./bot/Makefile /bot/Makefile

docker/bot.Dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
FROM lappis/coach:boilerplate as coach
2-
FROM lappis/botrequirements:boilerplate
1+
FROM botrequirements
32

43
WORKDIR /bot
54

65
COPY ./bot /bot
76
COPY ./modules /modules
8-
COPY --from=coach /src_models/ /bot/models/
9-
10-
RUN chown -R 1001 /bot/models && chmod -R 750 /bot/models
117

128
RUN find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf

docker/coach.Dockerfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
FROM lappis/botrequirements:boilerplate
1+
FROM botrequirements as coach
22

3-
COPY ./bot/ /coach/
3+
WORKDIR /bot
44

5-
RUN mkdir /src_models
6-
7-
WORKDIR /coach
5+
COPY ./bot/ /bot/
86

97
RUN make train
10-
11-
RUN find /. | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf

docker/requirements.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.6-slim
1+
FROM python:3.6-slim as botrequirements
22

33
RUN apt update && apt install -y gcc make
44

0 commit comments

Comments
 (0)