#!/bin/bash

display_usage() {
  echo -e "Usage:\n\t$0 <version> \n\nExample:\n\t$0 45"
}

if [ -z "${WORDPRESS_VERSION}" ]; then
  if [ $# -eq 0 ]; then
    display_usage
    exit 1
  fi

  export WORDPRESS_VERSION="$1"
fi

function stop_services {
  docker-compose down
}

function teardown {
  stop_services
}

trap teardown EXIT
docker-compose up --build
