mirror of
				https://github.com/avatao-content/test-tutorial-framework
				synced 2025-11-04 02:42:56 +00:00 
			
		
		
		
	Move hack folder to this repo from baseimage & frontend ^^
This commit is contained in:
		
							
								
								
									
										21
									
								
								hack/bootstrap_tfw_dev.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										21
									
								
								hack/bootstrap_tfw_dev.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
LOGFILE="/tmp/bootstrap_tfw.log"
 | 
			
		||||
trap 'echo "Something went wrong. Read the log az $LOGFILE"' ERR
 | 
			
		||||
 | 
			
		||||
printf "Cloning TFW repositories... "
 | 
			
		||||
printf "baseimage... " && git clone git@github.com:avatao-content/baseimage-tutorial-framework.git >> $LOGFILE 2>&1
 | 
			
		||||
printf "frontend... " && git clone git@github.com:avatao-content/frontend-tutorial-framework.git >> $LOGFILE 2>&1
 | 
			
		||||
printf "test... " && git clone git@github.com:avatao-content/test-tutorial-framework.git >> $LOGFILE 2>&1
 | 
			
		||||
printf "Done!\n\n"
 | 
			
		||||
 | 
			
		||||
printf "Building baseimage and installing frontend dependencies... "
 | 
			
		||||
 | 
			
		||||
cd baseimage-tutorial-framework
 | 
			
		||||
docker build -t baseimage-tutorial-framework . >> $LOGFILE 2>&1 &
 | 
			
		||||
 | 
			
		||||
cd ../frontend-tutorial-framework
 | 
			
		||||
yarn install >> $LOGFILE 2>&1
 | 
			
		||||
 | 
			
		||||
printf "Done!\n"
 | 
			
		||||
rm $LOGFILE
 | 
			
		||||
							
								
								
									
										34
									
								
								hack/tfw_magic_start.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										34
									
								
								hack/tfw_magic_start.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
[ "$(uname)" == "Darwin" ] && readlink_cmd="greadlink" || readlink_cmd="readlink"
 | 
			
		||||
SCRIPT_DIR="$(dirname $($readlink_cmd -f $0))"
 | 
			
		||||
 | 
			
		||||
TAO_PATH="${TAO_PATH:-$SCRIPT_DIR/../..}"
 | 
			
		||||
BACKEND_REPO="${BACKEND_REPO:-test-tutorial-framework}"
 | 
			
		||||
FRONTEND_REPO="${FRONTEND_REPO:-frontend-tutorial-framework}"
 | 
			
		||||
BACKEND_PATH="${TAO_PATH}/${BACKEND_REPO}"
 | 
			
		||||
FRONTEND_PATH="${TAO_PATH}/${FRONTEND_REPO}"
 | 
			
		||||
 | 
			
		||||
IMAGE_NAME="${IMAGE_NAME:-baseimage-tutorial-framework}"
 | 
			
		||||
BACKEND_PORT="${BACKEND_PORT:-8888}"
 | 
			
		||||
AVATAO_SECRET="${AVATAO_SECRET:-secret}"
 | 
			
		||||
BUILD_CONTEXT="${BUILD_CONTEXT:-solvable}"
 | 
			
		||||
 | 
			
		||||
function run_frontend()
 | 
			
		||||
{
 | 
			
		||||
    cd $FRONTEND_PATH
 | 
			
		||||
    yarn start
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function run_backend()
 | 
			
		||||
{
 | 
			
		||||
    cd $BACKEND_PATH
 | 
			
		||||
    docker build -t $IMAGE_NAME -f ${BUILD_CONTEXT}/Dockerfile --build-arg BUILD_CONTEXT=$BUILD_CONTEXT --build-arg NOFRONTEND=1 .
 | 
			
		||||
    docker run --rm -p $BACKEND_PORT:$BACKEND_PORT -e AVATAO_SECRET=$AVATAO_SECRET $IMAGE_NAME
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
trap 'exit' INT TERM
 | 
			
		||||
trap 'kill 0' EXIT
 | 
			
		||||
run_frontend & run_backend
 | 
			
		||||
wait
 | 
			
		||||
		Reference in New Issue
	
	Block a user