Automating action server image builds by Github Action

This is my yml file under workflows folder

name: Action Server
on: 
  push:
    branches:
    - 'main'
    paths:
    - 'actions/**'

jobs:
  build_and_deploy:
    runs-on: ubuntu-20.04
    name: Build Action Server image and upgrade Rasa X deployment
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - id: action_server
        name: Build an action server with a custom actions
        uses: RasaHQ/action-server-gha@main
        with:
          actions_directory: ./actions 
          requirements_file: ./actions/requirements-actions.txt
          docker_registry_login: ${{ secrets.DOCKER_HUB_LOGIN }}
          docker_registry_password: ${{ secrets.DOCKER_HUB_PASSWORD }}
          docker_image_name: 'jpark2111/wealthbuild_rasa_action_server'
          docker_image_tag: ${{ github.sha }}
          docker_registry_push: true
          dockerfile: Dockerfile

I got error as below,

I’m using docker hub credential, what parameter should be changed or added to yml file? What docker registry should I use? tried docker.io, hub.docker.com but no luck. I’m new to docker and github action :frowning: Any help would be appreciated!

@jpark2111 Sure, nothing to worry :slight_smile:

Can I suggest some changes, if you allow me?

Always mention me with @ nik202

Sure @nik202 what is a suggestion?

@jpark2111

  1. I hope you have mentioned the DOCKER_HUB_LOGIN and DOCKER_HUB_PASSWORD secrets key inside Actions on Github? Details of this link: Docker Hub

  2. Can you change the docker_image_tag: ${{ github.sha }} to docker_image_tag: 'latest'

It’s easy to use as SHA has a long sequence of ASCI characters Digest.

  1. Can we make a DockerHub registry private?

  2. Can you change this runs-on: ubuntu-20.04 to runs-on: ubuntu-latest

  3. Is your requirements-actions.txt is similar to what you mentioned in the actions folder?

Ref: helpdesk-assistant/continuous-integration.yml at main · RasaHQ/helpdesk-assistant · GitHub

Please follow this and you will be able to push actions_server image to docker hub.

Good Luck! If you have any doubt do let me know.

  1. Yeah I added DOCKER_HUB_LOGIN and DOCKER_HUB_PASSWORD secrets key inside Actions on my Github page
  2. changed to ‘latest’
  3. I made my docker repo private
  4. changed to ubuntu-latest
  5. requirements-actions.txt is in actions folder

still getting same error

Login to the docker.io registry.
Error response from daemon: Get "https://registry-1.docker.io/v2/": unauthorized: incorrect username or password
Error: Process completed with exit code 1.

@jpark2111 delete the DOCKER_HUB_LOGIN and DOCKER_HUB_PASSWORD secrets key and do it again it’s only the issue of login and password.

On Github: Screenshot 2022-01-26 at 8.05.21 PM

Above output, you are getting in actions on Github actions?

I removed it and added them again. this is a right place to add secrets right? still getting same error @nik202

@jpark2111 can you share Dockerfile and it’s in the actions folder or outside?

I have dockerfile outside of actions folder, image

sharing Dockerfile

FROM rasa/rasa-sdk:2.8.2

WORKDIR /app

COPY actions /app/actions

USER root
RUN pip install --no-cache-dir -r /app/actions/requirements-actions.txt

USER 1001
CMD ["start", "--actions", "actions"]

@jpark2111 please put the Dockerfile inside actions folder and mentioned the path in actions.yml

name: Action Server

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
    paths:
    - 'actions/**'
    - '.github/workflows/action_server.yml'

jobs:
  build_and_deploy:
    runs-on: ubuntu-latest
    name: Build and push Action Server Image
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - id: action_server
      name: Build an action server with a custom actions
      uses: RasaHQ/action-server-gha@main
      # Full list of parameters: https://github.com/RasaHQ/action-server-gha/tree/main#input-arguments
      with:
          actions_directory: './actions'
          requirements_file: 'actions/requirements.txt'
          docker_image_name: 'rasa/action_server'
          docker_registry_login: ${{ secrets.DOCKERHUB_LOGIN }}
          docker_registry_password: ${{ secrets.DOCKERHUB_PASSWORD }}
          docker_image_tag: 'actionserver'
          dockerfile: 'actions/Dockerfile'

If the issue of unauthorized comes again, then you are not putting the username or password correctly in secret keys.

Thanks.

ahh it was credential problem… it didn’t let me use the email that I’ve been using to log in to docker hub :frowning: Solved! Thank you @nik202

One more question. I was able to build action server image with github actions, but once I use the image rasa x can’t talk to action server so that custom action doesn’t get triggered. But when I use the image I built in local and pushed, rasa x can talk to it. What’s the possibility that the image built by github action doesn’t work as expected? custom actions doesn’t get triggered at all. @nik202

@jpark2111

Did you update the value of the image in the docker-compose.override.yml as such?

version: '3.4'
services:
  app:
    image: <account_username>/<repository_name>:<new_custom_image_tag>

Yes I did, once I updated it with new image built by github action it doesn’t work :frowning:

@jpark2111 share mein GitHub Action code, docker-compose.override.yml and docker ps please.