neko/dev/serve

37 lines
796 B
Plaintext
Raw Normal View History

2022-07-17 06:53:37 +12:00
#!/bin/sh
cd "$(dirname "$0")"
if [ -z $NEKO_PORT ]; then
NEKO_PORT="3000"
fi
if [ -z $NEKO_HOST ]; then
for i in $(ifconfig -l 2>/dev/null); do
NEKO_HOST=$(ipconfig getifaddr $i)
if [ ! -z $NEKO_HOST ]; then
break
fi
done
if [ -z $NEKO_HOST ]; then
NEKO_HOST=$(hostname -i 2>/dev/null)
fi
fi
echo "Using app port: ${NEKO_PORT}"
echo "Using IP address: ${NEKO_HOST}"
APP_PATH="$(realpath ../)"
2022-07-17 06:53:37 +12:00
# npm run serve
docker run --rm -it \
2024-03-17 23:21:50 +13:00
-p 3001:3001 \
2022-07-17 06:53:37 +12:00
-e "NEKO_HOST=$NEKO_HOST" \
-e "NEKO_PORT=$NEKO_PORT" \
2022-09-16 05:30:45 +12:00
-e "VUE_APP_LOG_COLOR=true" \
2022-07-17 06:53:37 +12:00
--user "$(id -u):$(id -g)" \
--volume "$APP_PATH:$APP_PATH" \
2022-07-17 06:53:37 +12:00
--entrypoint="npm" \
--workdir="$APP_PATH" \
2024-03-17 23:21:50 +13:00
node:18-buster-slim run dev -- --port 3001 --host