Skip to content

Commit

Permalink
Docker compose is achieved
Browse files Browse the repository at this point in the history
  • Loading branch information
sysang committed Jun 21, 2022
1 parent 3d32a37 commit 12e97cc
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 27 deletions.
22 changes: 0 additions & 22 deletions botserver-app/Dockerfile

This file was deleted.

1 change: 1 addition & 0 deletions docker-builds/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
tensorflow-v2.6.4/
tensorflow-2.7.3/
rasa-3.2.1/
Dockerfile
45 changes: 45 additions & 0 deletions docker-builds/Dockerfile-rasa-3.2.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# The default Docker image
ARG IMAGE_BASE_NAME
ARG BASE_IMAGE_HASH
ARG BASE_BUILDER_IMAGE_HASH

# EDITED: use this build as image
FROM ${IMAGE_BASE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}
# copy files
COPY . /build/

# change working directory
WORKDIR /build

# install dependencies
# EDITED: add `poetry env use system` -> to use global python
# EDITED: add `poetry config virtualenvs.create false` -> to install deps into global package-list instead of virtualenv
RUN pip install --no-cache-dir -U "pip==21.*" && \
poetry env use system && \
poetry config virtualenvs.create false && \
poetry install --no-dev --no-root --no-interaction && \
poetry build -f wheel -n && \
pip install --no-deps dist/*.whl && \
rm -rf dist *.egg-info

# set HOME environment variable
ENV HOME=/app

# update permissions & change user to not run as root
WORKDIR /app
RUN rm -rf /build


RUN chgrp -R 0 /app && chmod -R g=u /app && chmod o+wr /app
USER 1001

# create a volume for temporary data
VOLUME /tmp

# change shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# the entry point
EXPOSE 5005
ENTRYPOINT ["rasa"]
CMD ["--help"]
2 changes: 1 addition & 1 deletion docker-builds/Dockerfile-tf-v2.7.3
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ RUN pip --no-cache-dir install \
wheel \
keras_applications \
keras_preprocessing \
numpy~=1.21.4 \
numpy==1.21.4 \
--no-deps \
&& rm -rf /pip_pkg \
&& rm -rf /tmp/* \
Expand Down
8 changes: 7 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ x-nginx-host-variables: &nginx-host-variables
RASA_X_HOST: "rasa-x:5002"
RASA_USER_APP: "action-server:5055"
RASA_PRODUCTION_HOST: "rasa-production:5005"
BOT_FRONTEND_HOST: "botfrontend:5005"

x-rasax-credentials: &rasax-credentials
RASA_X_HOST: "http://rasa-x:5002"
Expand Down Expand Up @@ -152,7 +153,10 @@ services:
action-server:
restart: on-failure:5
image: "sysang/actionserver"
build: "./botserver-action"
build:
context: "./botserver-action"
args:
RASA_SDK_IMAGE: ${RASA_SDK_IMAGE}
volumes:
- ./botserver-action/:/app/actions/
expose:
Expand Down Expand Up @@ -207,6 +211,8 @@ services:
depends_on:
- rasa-x
- rasa-production
- rasa-worker
- botfrontend

redis:
restart: on-failure:5
Expand Down
2 changes: 1 addition & 1 deletion nginx-config-files/rasax.nginx.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ upstream docker-rasax-api {
}

upstream docker-bot-frontend {
server http://botfrontend:8000 max_fails=0;
server ${BOT_FRONTEND_HOST} max_fails=0;
}

server {
Expand Down
11 changes: 9 additions & 2 deletions note.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ https://forum.rasa.com/t/trigger-intent-from-custom-action/51727/6
Training data must declare condition (slot information), otherwise training machenisim will impose initinal slot information as condition (very implicit).
This makes rules (were not declare condition) mostly uneffective in runtime because the condition mostly would have been changed.

# It seems that action without preceded intent is ingored

# To inspect training dataset

```python
Expand Down Expand Up @@ -41,3 +39,12 @@ for tracker_state, label in zip(tracker_state_features, label_ids):
`sudo nvim /etc/docker/daemon.json`
`{"dns": ["192.168.1.1"]}`
`sudo service docker restart`

# Build rasa:localdev for old processor which does not support new computing instruction set
## rasa-3.2.1, tensorflow-2.7.3
- `wget https://github.com/RasaHQ/rasa/archive/refs/tags/3.2.1.tar.gz`
- `wget https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.7.3.tar.gz`
- use Dockerfile-tf-v2.7.3 to build image -> sysang/tf-2.7.3-source-build
- replace base image in rasa-3.2.1/docker/Dockerfile.base by sysang/tf-2.7.3-source-build:latest
- replace rasa-3.2.1/Dockerfile by Dockerfile-rasa-3.2.1, use Dockerfile-rasa-3.2.1 to build rasa:localdev
- (replace peotry.lock by peotry-rasa-3.2.1.lock which is resolved by pyproject.toml after exclude tensorflow section and set numpy===1.21.4)

0 comments on commit 12e97cc

Please sign in to comment.