#!/bin/bash

image="262628360495.dkr.ecr.us-east-1.amazonaws.com/dapi-docker:frontend-dev-v2"
path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

# Go to the root of the repo
cd "$path"
cd ../../../
docker_mount_location=$(pwd -P)

# Feed all given args into container
ENV_VARS=''
for arg in $@; do
  ENV_VARS+="-e $arg "
done

# Pull the latest image
docker pull $image

# Build the image
docker run \
  --rm \
  -v $docker_mount_location:/var/www/deliveryApi/frontend \
  $ENV_VARS \
  -it \
  $image

