#!/bin/sh

set -eux

IMAGE_NAME="phc/storage"
CONTAINER_NAME="storage"

HOST_PORT="4000"

git pull
docker build -t "$IMAGE_NAME" .

docker stop "$CONTAINER_NAME" || true
docker run -d \
    --name "$CONTAINER_NAME" \
    --rm \
    -p "$HOST_PORT:4000" \
    -v "$(pwd)/buckets:/app/buckets" \
    -v "$(pwd)/database.local.json:/app/database.local.json" \
     "$IMAGE_NAME"
