updated docker build

This commit is contained in:
Marvin Zhang
2022-05-16 14:17:29 +08:00
parent 57ba52ff02
commit 7fafb01d1d
5 changed files with 29 additions and 8 deletions

View File

@@ -43,3 +43,8 @@ jobs:
docker tag image $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
if [[ $VERSION -eq "latest" ]]; then
docker tag image $IMAGE_ID:main
docker push $IMAGE_ID:main
fi

View File

@@ -4,12 +4,19 @@ then
:
else
indexpath=/app/dist/index.html
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}
if [[ -v CRAWLAB_BASE_URL ]]; then
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 [[ -v CRAWLAB_INIT_BAIDU_TONGJI ]]; then
sed -i "s/ window.VUE_APP_INIT_BAIDU_TONGJI =/ window.VUE_APP_INIT_BAIDU_TONGJI = '${CRAWLAB_INIT_BAIDU_TONGJI}'/g" ${indexpath}
fi
if [[ -v CRAWLAB_INIT_UMENG ]]; then
sed -i "s/ window.VUE_APP_INIT_UMENG =/ window.VUE_APP_INIT_UMENG = '${CRAWLAB_INIT_UMENG}'/g" ${indexpath}
fi
fi
# start nginx

View File

@@ -1 +1,3 @@
VUE_APP_API_BASE_URL=/api
VUE_APP_INIT_BAIDU_TONGJI=
VUE_APP_INIT_UMENG=

View File

@@ -8,7 +8,9 @@
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width,initial-scale=1.0" name="viewport">
<script>
window.VUE_APP_API_BASE_URL = '<%= VUE_APP_API_BASE_URL %>'
window.VUE_APP_API_BASE_URL = '<%= VUE_APP_API_BASE_URL %>';
window.VUE_APP_INIT_UMENG = '<%= VUE_APP_INIT_UMENG %>';
window.VUE_APP_INIT_BAIDU_TONGJI = '<%= VUE_APP_INIT_BAIDU_TONGJI %>';
</script>
<script src="/js/vue3-sfc-loader.js"></script>
<script src="/js/umeng.js"></script>

View File

@@ -3,5 +3,10 @@ import 'vue';
import {createApp} from 'crawlab-ui';
(async function () {
await createApp();
await createApp({
// @ts-ignore
initBaiduTongji: window['VUE_APP_INIT_BAIDU_TONGJI'] !== 'false',
// @ts-ignore
initUmeng: window['VUE_APP_INIT_UMENG'] !== 'false',
});
})();