27 lines
572 B
Bash
Executable File
27 lines
572 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT=$(cd "$(dirname "$0")" && pwd)
|
|
cd "$ROOT"
|
|
|
|
IMAGE_TAG="avanzacast/backend-api:local"
|
|
|
|
# Build the image
|
|
docker build -t "$IMAGE_TAG" .
|
|
|
|
# Run container mapping port 4000
|
|
CONTAINER_NAME="avz_backend_local"
|
|
# stop existing
|
|
docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true
|
|
|
|
docker run -d --name "$CONTAINER_NAME" -p 4000:4000 \
|
|
-e HOST=0.0.0.0 -e PORT=4000 \
|
|
"$IMAGE_TAG"
|
|
|
|
echo "Started container $CONTAINER_NAME (image $IMAGE_TAG)"
|
|
|
|
echo 'Wait 2s then curl /health'
|
|
sleep 2
|
|
curl -sS http://localhost:4000/health || true
|
|
|