Commit cb619ca6 authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

Update mock server, to be included in a simply way to test locally

parent 12a85fce
Loading
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ help() {
  echo "       -v : Clean vault service"
  echo "       -r : Clean register service"
  echo "       -m : Clean monitoring service"
  echo "       -s : Clean Robot Mock service"
  echo "       -a : Clean all services"
  echo "       -h : show this help"
  exit 1
@@ -21,7 +22,7 @@ FILES=()
echo "${FILES[@]}"

# Read params
while getopts "cvrahm" opt; do
while getopts "cvrahms" opt; do
  case $opt in
    c)
      echo "Remove Capif services"
@@ -39,9 +40,13 @@ while getopts "cvrahm" opt; do
      echo "Remove monitoring service"
      FILES+=("../monitoring/docker-compose.yml")
      ;;
    s)
      echo "Robot Mock Server"
      FILES+=("docker-compose-mock-server.yml")
      ;;
    a)
      echo "Remove all services"
      FILES=("docker-compose-capif.yml" "docker-compose-vault.yml" "docker-compose-register.yml" "../monitoring/docker-compose.yml")
      FILES=("docker-compose-capif.yml" "docker-compose-vault.yml" "docker-compose-register.yml" "docker-compose-mock-server.yml" "../monitoring/docker-compose.yml")
      ;;
    h)
      help
+16 −0
Original line number Diff line number Diff line
#!/bin/bash

FILE="docker-compose-mock-server.yml"

echo "Executing 'docker compose down' for file $FILE"
docker compose -f "$FILE" down --rmi all
status=$?
  if [ $status -eq 0 ]; then
      echo "*** Removed Service from $FILE ***"
  else
      echo "*** Some services of $FILE failed on clean ***"
  fi

docker volume prune --all --force

echo "Clean complete."
+20 −0
Original line number Diff line number Diff line
services:
  mock-server:
    build:
      context: ./mock_server
    ports:
      - 9090:9090
    volumes:
      - ./mock_server:/usr/src/app
    extra_hosts:
      - host.docker.internal:host-gateway
    restart: unless-stopped
    image: public.ecr.aws/o2v4a8t6/opencapif/mock_server:latest

networks:
  default:
    name: capif-network
    external: true


+21 −0
Original line number Diff line number Diff line
# start by pulling the python image
FROM python:3.10.0-alpine

# copy the requirements file into the image
COPY ./requirements.txt /app/requirements.txt

# switch working directory
WORKDIR /app

# install the dependencies and packages in the requirements file
RUN pip install -r requirements.txt

# copy every content from the local file to the image
COPY . /app

EXPOSE 9090

# configure the container to run in an executed manner
ENTRYPOINT [ "python" ]

CMD ["mock_server.py" ]
 No newline at end of file
Loading