move devs to client & server.

This commit is contained in:
Miroslav Šedivý 2024-09-08 11:52:47 +02:00
parent b617c5cc32
commit 3d7be663ec
10 changed files with 63 additions and 113 deletions

View file

@ -5,14 +5,3 @@
# this is how will be your images called. you can change it to your fork. # this is how will be your images called. you can change it to your fork.
# only need to do this once. here. # only need to do this once. here.
BUILD_IMAGE="m1k1o/neko" BUILD_IMAGE="m1k1o/neko"
# this is where your services will be acessible
CLIENT_PORT=8080
SERVER_PORT=8081
# on which image you want to test it
SERVER_TAG="chromium"
# this is needed for WebRTC. specify your local IP address and free UDP port range.
SERVER_EPR=55000-55009
SERVER_IP=10.8.0.1

View file

@ -27,10 +27,9 @@ then
unset ENV_BUILD_IMAGE unset ENV_BUILD_IMAGE
fi fi
if [ -z "${1}" ] && [ ! -z "${SERVER_TAG}" ] if [ -z "${1}" ]
then then
./build base ./build base
./build ${SERVER_TAG}
exit 0 exit 0
fi fi

View file

@ -1,25 +0,0 @@
#!/bin/bash
if [ -f ".env.default" ]
then
export $(cat .env.default | sed 's/#.*//g' | xargs)
fi
if [ -f ".env" ]
then
export $(cat .env | sed 's/#.*//g' | xargs)
fi
# use -f to force rebuild
if [ "$(docker images -q neko_dev_server 2> /dev/null)" == "" ] || [ "$1" == "-f" ]; then
docker build -t neko_dev_server -f base/Dockerfile --target server ../
fi
docker run --rm -it \
-v "${PWD}/../server:/src" \
-e GIT_COMMIT=`git rev-parse --short HEAD` \
-e GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD` \
-e GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "✗-"` \
--entrypoint="bash" \
--workdir="/src" \
neko_dev_server ./build

View file

@ -1,29 +0,0 @@
#!/bin/bash
if [ -f ".env.default" ]
then
export $(cat .env.default | sed 's/#.*//g' | xargs)
fi
if [ -f ".env" ]
then
export $(cat .env | sed 's/#.*//g' | xargs)
fi
# use -i to install
if [ ! -d "${PWD}/../client/node_modules" ] || [ "$1" == "-i" ]; then
docker run --rm -it \
-v "${PWD}/../client:/app" \
--workdir="/app" \
--entrypoint="npm" \
node:18-bullseye-slim install
fi
docker run --rm -it \
-p "${CLIENT_PORT}:8080" \
-v "${PWD}/../client:/app" \
-e "VUE_APP_SERVER_PORT=${SERVER_PORT}" \
--workdir="/app" \
--entrypoint="npm" \
node:18-bullseye-slim run serve

View file

@ -1,46 +0,0 @@
#!/bin/bash
if [ -f ".env.default" ]
then
export $(cat .env.default | sed 's/#.*//g' | xargs)
fi
if [ -f ".env" ]
then
export $(cat .env | sed 's/#.*//g' | xargs)
fi
BINARY_PATH="${PWD}/../server/bin/neko"
# use -r to rebuild
if [ ! -f "${BINARY_PATH}" ] || [ "$1" == "-r" ]; then
./rebuild-server
fi
# if image starts with nvidia- add --gpus all
if [[ "${SERVER_TAG}" == "nvidia-"* ]]; then
GPU_FLAG="--gpus all"
echo "Nvidia GPU acceleration enabled"
fi
# if image starts with intel- add --device /dev/dri
if [[ "${SERVER_TAG}" == "intel-"* ]]; then
GPU_FLAG="--device /dev/dri"
echo "Intel GPU acceleration enabled"
fi
# use --gpus all to enable GPU acceleration
docker run --rm -it \
--name "neko_dev" \
$GPU_FLAG \
-p "${SERVER_PORT}:8080" \
-p "${SERVER_EPR}:${SERVER_EPR}/udp" \
-e "NEKO_SCREEN=1920x1080@60" \
-e "NEKO_EPR=${SERVER_EPR}" \
-e "NEKO_NAT1TO1=${SERVER_IP}" \
-e "NEKO_ICELITE=true" \
-e "NEKO_MAX_FPS=25" \
-v "${BINARY_PATH}:/usr/bin/neko" \
--shm-size=2G \
--cap-add SYS_ADMIN \
${BUILD_IMAGE}:${SERVER_TAG}

10
client/dev/build Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
cd "$(dirname "$0")"
# start component watch
docker run --rm -it \
--user "$(id -u):$(id -g)" \
--volume "${PWD}/../:/app" \
--entrypoint="npm" \
--workdir="/app" \
node:18-bullseye-slim run build

10
client/dev/exec Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
cd "$(dirname "$0")"
# start component watch
docker run --rm -it \
--user "$(id -u):$(id -g)" \
--volume "${PWD}/../:/app" \
--entrypoint="/bin/bash" \
--workdir="/app" \
node:18-bullseye-slim

10
client/dev/npm Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
cd "$(dirname "$0")"
# npm
docker run --rm -it \
--user "$(id -u):$(id -g)" \
--volume "${PWD}/../:/app" \
--entrypoint="npm" \
--workdir="/app" \
node:18-bullseye-slim "$@"

27
client/dev/serve Executable file
View file

@ -0,0 +1,27 @@
#!/bin/bash
cd "$(dirname "$0")"
if [ -z $VUE_APP_SERVER_PORT ]; then
VUE_APP_SERVER_PORT="3000"
fi
echo "Using VUE_APP_SERVER_PORT: ${VUE_APP_SERVER_PORT}"
# use -i to install
if [ ! -d "${PWD}/../node_modules" ] || [ "$1" == "-i" ]; then
docker run --rm -it \
--volume "${PWD}/../:/app" \
--workdir="/app" \
--entrypoint="npm" \
node:18-bullseye-slim install
fi
# npm run serve
docker run --rm -it \
-p 3001:3001 \
-e "VUE_APP_SERVER_PORT=$VUE_APP_SERVER_PORT" \
--user "$(id -u):$(id -g)" \
--volume "${PWD}/../:/app" \
--entrypoint="npm" \
--workdir="/app" \
node:18-bullseye-slim run serve -- --port 3001

View file

@ -36,6 +36,11 @@ if [ "$1" = "nvidia" ]; then
echo "Starting nvidia docker image" echo "Starting nvidia docker image"
EXTRAOPTS="--gpus all" EXTRAOPTS="--gpus all"
CONFIG="config.nvidia.yml" CONFIG="config.nvidia.yml"
elif [ "$1" = "intel" ]; then
echo "Starting intel docker image"
EXTRAOPTS="--device /dev/dri"
# TODO: add intel config
# CONFIG="config.intel.yml"
else else
echo "Starting default docker image" echo "Starting default docker image"
EXTRAOPTS="" EXTRAOPTS=""