#!/bin/sh

docker build \
    -t f-platform-api \
    .

docker stop f-platform-api-test || true \
    && docker rm f-platform-api-test || true

echo F_PLATFORM_APP_BUILD_ID ${F_PLATFORM_APP_BUILD_ID}

docker run \
    -it -d \
    --restart always \
    -v $(pwd):/app \
    -v $HOME/f-platform-api-test-logs:/app/logs \
    -v $HOME/.cache/ms-playwright-test:/root/.cache/ms-playwright \
    -p 8091:8090 \
    -e F_PLATFORM_APP_BUILD_ID=${F_PLATFORM_APP_BUILD_ID} \
    -e F_PLATFORM_LOGGING_PATH=/app/logs \
    -e F_PLATFORM_POSTGRESQL_URL=jdbc:postgresql://172.17.0.1:5433/f_platform \
    -e F_PLATFORM_POSTGRESQL_USERNAME=test \
    -e F_PLATFORM_POSTGRESQL_PASSWORD=test \
    --name f-platform-api-test \
    f-platform-api
