#!/bin/bash

# Define a name for the image
IMAGE_NAME="e2e-pxl-env"

# Build the image from the Dockerfile in the current directory
docker build -t $IMAGE_NAME ./e2e/

# Run a container from the built image
# Add user mapping only on Linux/WSL to avoid permission issues with mounted volumes
USER_FLAG=""
if [[ "$(uname)" = "Linux" ]]; then
    USER_FLAG="-u $(id -u):$(id -g)"
fi

docker run -p 3030:3030 $USER_FLAG -v ${PWD}:/pxl -w /pxl/e2e --rm -it $IMAGE_NAME /bin/bash

