Commit 258152f8 authored by Stavros-Anastasios Charismiadis's avatar Stavros-Anastasios Charismiadis
Browse files

Edit Dockerfile: flexible network settings

parent 41b2396e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ To start the service, follow the steps below
6. To deploy the service, run the following commands in an Ubuntu or MacOS terminal. To stop the invoker just press Ctrl+C or Command+C
```
    chmod +x start_invoker.sh
    ./start_invoker.sh <Participant name or username>
    ./start_invoker.sh -u <username given by organizers> [-n <host:ip>]"
```

7. To remove the files of the invoker instance (invoker_info, logs and pkl file), execute the following commands.
+35 −9
Original line number Diff line number Diff line
#!/bin/bash

if [ $# -lt 1 ]; then
    echo "Usage: ./start_invoker.sh <your_capif_username>"
    echo "Error: No username provided. Stopping."
USER_NAME=""
ADD_HOST_FLAG=""

help() {
  echo "Usage: $1 <options>"
  echo "       -n : Setup host record inside container for the CCF (used when CAPIF is deployed locally)"
  echo "       -u : Provide the username given by the organizers"
  echo "       -h : show this help"
  exit 1
}

# Read params
while getopts "n:u:" opt; do
  case $opt in
    n)
      ADD_HOST_FLAG="--add-host $OPTARG"
      ;;
    u)
      USER_NAME="$OPTARG"
      ;;
    \?)
      echo "Invalid option"
      exit 1
      ;;
  esac
done

# Mandatory Check
# -z checks if the string is empty
if [[ -z "$USER_NAME" ]]; then
    echo "Error: The -u [user_name] argument is mandatory."
    echo "Usage: $0 -u <name> [-n <host:ip>]"
    exit 1
fi

echo "Create invoker service for user: $1"
echo "Create invoker service for user: $USER_NAME"

docker build -t invoker-service .

docker run -it --rm \
  -p 8001:8001 \
  -e USER_NAME=$1 \
  -e USER_NAME=$USER_NAME \
  -v "$(pwd):/app" \
  --name invoker \
  --add-host capifcore:host-gateway \
  $ADD_HOST_FLAG \
  invoker-service

#docker run --name "invoker" --network host -e PORT=8001 -v "$(pwd):/app" invoker-service
#docker run --name "invoker" -p 8001:8001 -v "$(pwd):/app" invoker-service
 No newline at end of file