Skip to content

Commit

Permalink
Merge pull request #5404 from RasaHQ/sdk-no-root
Browse files Browse the repository at this point in the history
explain no-root user for SDK image
  • Loading branch information
indam23 authored Mar 11, 2020
2 parents e6d0ad0 + 28c9b3a commit c266fa5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/5404.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Explain how to run commands as ``root`` user in Rasa SDK Docker images since version
``1.8.0``. Since version ``1.8.0`` the Rasa SDK Docker images does not longer run as
``root`` user by default. For commands which require ``root`` user usage, you have to
switch back to the ``root`` user in your Docker image as described in
:ref:`deploying-your-rasa-assistant_custom-dependencies`.
11 changes: 10 additions & 1 deletion docs/user-guide/how-to-deploy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ Then build a custom action using the Rasa SDK, e.g.:
def name(self):
return "action_joke"
def run(self, dispatcher, tracker, domain):
async def run(self, dispatcher, tracker, domain):
request = requests.get('http://api.icndb.com/jokes/random').json() # make an api call
joke = request['value']['joke'] # extract a joke from returned json response
dispatcher.utter_message(text=joke) # send the message back to the user
Expand Down Expand Up @@ -382,6 +382,8 @@ Add this to your ``endpoints.yml`` (if it does not exist, create it):
Run ``docker-compose up`` to start the action server together
with Rasa.

.. _deploying-your-rasa-assistant_custom-dependencies:

Adding Custom Dependencies
**************************

Expand All @@ -396,13 +398,20 @@ image and add your custom dependencies. For example:
# Extend the official Rasa SDK image
FROM rasa/rasa-sdk:latest
# The Rasa SDK image runs as non-root user by default. Hence, you have to switch
# back to the `root` user if you want to install additional dependencies.
USER root
# Add a custom system library (e.g. git)
RUN apt-get update && \
apt-get install -y git
# Add a custom python library (e.g. jupyter)
RUN pip install --no-cache-dir jupyter
# Switch back to a non-root user
USER 1001
You can then build the image via the following command, and use it in your
``docker-compose.yml`` instead of the ``rasa/rasa-sdk`` image.

Expand Down

0 comments on commit c266fa5

Please sign in to comment.