
.PHONY: all prod test

all: sxkj idctest txtest txprod

prod:
	@DOCKER_BUILDKIT=1 docker build -f Dockerfile.dev  --build-arg BUILDKIT_INLINE_CACHE=1  --target image-prod -t jupyterlab:prod .


test:
	@DOCKER_BUILDKIT=1 docker build -f Dockerfile.dev  --build-arg BUILDKIT_INLINE_CACHE=1  --target image-test -t jupyterlab:test .


sxkj:
	@sed 's#http.*\.com#http://aihub-dag\.sxkj\.com#' -i packages/yili-dag/src/request.ts
	@sed 's#http.*\.com#http://aihub-dag\.sxkj\.com#' -i packages/jldbq-extenison/src/api/config.ts
	@sed 's#http.*\.com#http://aihub-dag\.sxkj\.com#' -i packages/filebrowser/src/api/config.ts
	@docker build -f Dockerfile.dev  --target image-sxkj -t SXKJ:32775/jupyterlab:sxkj .
	@docker push SXKJ:32775/jupyterlab:sxkj

idctest:
	@sed 's#http.*\.com#http://aihub-dag-idctest\.digitalyili\.com#' -i  packages/yili-dag/src/request.ts
	@sed 's#http.*\.com#http://aihub-dag-idctest\.digitalyili\.com#' -i  packages/jldbq-extenison/src/api/config.ts
	@sed 's#http.*\.com#http://aihub-dag-idctest\.digitalyili\.com#' -i  packages/filebrowser/src/api/config.ts
	@docker build -f Dockerfile.dev  --target image-idctest -t registry.cn-hangzhou.aliyuncs.com/sxtest/jupyterlab:idctest .
	@docker push registry.cn-hangzhou.aliyuncs.com/sxtest/jupyterlab:idctest


txtest:
	@sed 's#http.*\.com#http://aihub-dag-test\.digitalyili\.com#' -i  packages/yili-dag/src/request.ts
	@sed 's#http.*\.com#http://aihub-dag-test\.digitalyili\.com#' -i  packages/jldbq-extenison/src/api/config.ts
	@sed 's#http.*\.com#http://aihub-dag-test\.digitalyili\.com#' -i  packages/filebrowser/src/api/config.ts
	@docker build -f Dockerfile.dev  --target image-txtest -t registry.cn-hangzhou.aliyuncs.com/sxtest/jupyterlab:txtest .
	@docker push registry.cn-hangzhou.aliyuncs.com/sxtest/jupyterlab:txtest

txprod:
	@sed 's#http.*\.com#http://aihub-dag\.digitalyili\.com#' -i  packages/yili-dag/src/request.ts
	@sed 's#http.*\.com#http://aihub-dag\.digitalyili\.com#' -i  packages/jldbq-extenison/src/api/config.ts
	@sed 's#http.*\.com#http://aihub-dag\.digitalyili\.com#' -i  packages/filebrowser/src/api/config.ts
	@docker build -f Dockerfile.dev  --target image-txprod -t registry.cn-hangzhou.aliyuncs.com/sxtest/jupyterlab:txprod .
	@docker push registry.cn-hangzhou.aliyuncs.com/sxtest/jupyterlab:txprod


rsync:
	@rsync -azP --exclude ".*/"  --exclude "tmp/" `pwd` sxkj@192.168.199.109:/home/sxkj/zhangli/jupyterlab
