Thierry Templier
Thierry Templier

Reputation: 202286

Deploy rasa application to dokku (docker)

I would like to deploy my rasa application to Dokku (= heroku-like + docker).

For this, I added a Dockerfile into my application:

FROM rasa/rasa:latest-spacy-en

RUN rasa train --domain domain.yml --data data --out models

EXPOSE 5100

CMD [ "rasa", "run", "-m", "models", "--enable-api" ]

The rasa docker image is successfully retrieved but I got this error when executing the rasa train command:

Step 2/4 : RUN rasa train --data data
 ---> Running in f263870fd730
The config file 'config.yml' is missing mandatory parameters: 'policies'. Add missing parameters to config file and try again.
remote: The command '/bin/sh -c rasa train --data data' returned a non-zero code: 1

I tried to create an explicit folder for the application with the following Dockerfile:

FROM rasa/rasa:latest-spacy-en

RUN mkdir -p /usr/src/app

WORKDIR /usr/src/app

COPY . /usr/src/app

RUN rasa train --domain domain.yml --data data --out models

EXPOSE 5100

CMD [ "rasa", "run", "-m", "models", "--enable-api" ]

But I got this error:

Step 2/7 : RUN mkdir -p /usr/src/app
 ---> Running in f78470eb6d93
mkdir: cannot create directory ‘/usr/src/app’: Permission denied
remote: The command '/bin/sh -c mkdir -p /usr/src/app' returned a non-zero code: 1

Here is my config.yml file:

# Configuration for Rasa NLU.

# https://rasa.com/docs/rasa/nlu/components/
language: fr
pipeline: pretrained_embeddings_spacy

# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
  - name: MemoizationPolicy
  - name: KerasPolicy
  - name: MappingPolicy
  - name: FormPolicy

Any ideas?

Thanks very much for your help! Thierry

Upvotes: 1

Views: 377

Answers (1)

Ella Rohm-Ensing
Ella Rohm-Ensing

Reputation: 346

Looks like you don't have permission to create a directory, you can try running as a root user in the Dockerfile? E.g.

FROM rasa/rasa:latest-spacy-en

USER root

RUN mkdir -p /usr/src/app

WORKDIR /usr/src/app

COPY . /usr/src/app

RUN rasa train --domain domain.yml --data data --out models

EXPOSE 5100

CMD [ "rasa", "run", "-m", "models", "--enable-api" ]

We don't run as root by default, so that's why the user doesn't have permission to create the folder.

Upvotes: 2

Related Questions