Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explain no-root user for SDK image #5404

Merged
merged 3 commits into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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