Files
UT-Registration-Plus/docker-entrypoint.sh
doprz a5e921fd75 feat(build): add Docker support (#322)
* feat(build): add Docker support

* fix: pnpm patches

* chore: update readme

* chore: refactor Docker section into separate markdown file

* chore: remove polling and host 0.0.0.0

* feat: add .dockerignore

* feat: update .dockerignore
2024-11-21 22:41:52 -06:00

47 lines
1012 B
Bash

#!/usr/bin/env bash
set -euo pipefail
# Define supported modes
SUPPORTED_MODES=("build" "zip" "dev")
# Function to display usage information
usage() {
echo "Usage: $0 [build|zip|dev]"
echo " build: Build the extension"
echo " zip: Build and zip the extension"
echo " dev: Run in development mode with HMR"
exit 1
}
# Check if BUILD_MODE is set, otherwise use the first argument
if [ -n "${BUILD_MODE:-}" ]; then
mode="$BUILD_MODE"
elif [ $# -eq 1 ]; then
mode="$1"
else
usage
fi
# Validate the mode
if [[ ! " ${SUPPORTED_MODES[*]} " =~ " ${mode} " ]]; then
echo "Error: Invalid mode '${mode}'" >&2
usage
fi
# Execute the appropriate command based on the mode
case "$mode" in
build)
echo "Building extension..."
exec pnpm run build
;;
zip)
echo "Building and zipping extension..."
exec pnpm run zip
;;
dev)
echo "Running in development mode with HMR..."
exec pnpm run dev
;;
esac