updated docker init

This commit is contained in:
Marvin Zhang
2022-05-16 21:38:42 +08:00
parent ed654ff504
commit de2c7acb7a

View File

@@ -1,28 +1,23 @@
# replace base url
if [ "${CRAWLAB_BASE_URL}" = "" ];
then
# replace env
indexpath=/app/dist/index.html
if test -z "$CRAWLAB_BASE_URL"; then
:
else
indexpath=/app/dist/index.html
if test -z "$CRAWLAB_BASE_URL"; then
:
else
sed -i "s?/js/?${CRAWLAB_BASE_URL}/js/?g" ${indexpath}
sed -i "s?/css/?${CRAWLAB_BASE_URL}/css/?g" ${indexpath}
sed -i "s/ <link rel=\"icon\" type=\"image\/x-icon\" href=\"/ <link rel=\"icon\" type=\"image\/x-icon\" href=\"\/${CRAWLAB_BASE_URL}/g" ${indexpath}
sed -i "s/ <link rel=\"stylesheet\" href=\"/ <link rel=\"stylesheet\" href=\"${CRAWLAB_BASE_URL}\//g" ${indexpath}
sed -i "s/ window.VUE_APP_API_BASE_URL = '/ window.VUE_APP_API_BASE_URL = '\/${CRAWLAB_BASE_URL}/g" ${indexpath}
fi
if test -z "$CRAWLAB_INIT_BAIDU_TONGJI"; then
:
else
sed -i "s/ window.VUE_APP_INIT_BAIDU_TONGJI =/ window.VUE_APP_INIT_BAIDU_TONGJI = '${CRAWLAB_INIT_BAIDU_TONGJI}'/g" ${indexpath}
fi
if test -z "$CRAWLAB_INIT_UMENG"; then
:
else
sed -i "s/ window.VUE_APP_INIT_UMENG =/ window.VUE_APP_INIT_UMENG = '${CRAWLAB_INIT_UMENG}'/g" ${indexpath}
fi
sed -i "s?/js/?${CRAWLAB_BASE_URL}/js/?g" ${indexpath}
sed -i "s?/css/?${CRAWLAB_BASE_URL}/css/?g" ${indexpath}
sed -i "s/ <link rel=\"icon\" type=\"image\/x-icon\" href=\"/ <link rel=\"icon\" type=\"image\/x-icon\" href=\"\/${CRAWLAB_BASE_URL}/g" ${indexpath}
sed -i "s/ <link rel=\"stylesheet\" href=\"/ <link rel=\"stylesheet\" href=\"${CRAWLAB_BASE_URL}\//g" ${indexpath}
sed -i "s/ window.VUE_APP_API_BASE_URL = '/ window.VUE_APP_API_BASE_URL = '\/${CRAWLAB_BASE_URL}/g" ${indexpath}
fi
if test -z "$CRAWLAB_INIT_BAIDU_TONGJI"; then
:
else
sed -i "s/ window.VUE_APP_INIT_BAIDU_TONGJI =/ window.VUE_APP_INIT_BAIDU_TONGJI = '${CRAWLAB_INIT_BAIDU_TONGJI}'/g" ${indexpath}
fi
if test -z "$CRAWLAB_INIT_UMENG"; then
:
else
sed -i "s/ window.VUE_APP_INIT_UMENG =/ window.VUE_APP_INIT_UMENG = '${CRAWLAB_INIT_UMENG}'/g" ${indexpath}
fi
# start nginx