#!/bin/bash

set -e

if [[ -z "$1" ]]; then
  echo "Error: requires region to start" >&2
  echo "" >&2
  echo "Usage $0 <region>" >&2
  echo "    region: china or global." >&2
  exit 1
fi

if [[ ! -f ".env.production.$1.runtime" ]]; then
    echo "Error: environment file .env.production.$1.runtime not found" >&2
  exit 1
fi


docker run --name="tidb-labs-$1-frontend" -p=3000:3000 --env-file=".env.production.$1.runtime" "${IMAGE_PREFIX}/tidb-labs-$1-frontend:latest"
