Commit 47079e6f authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

Try to create .env at build stage for frontend

parent b2c1b45d
Pipeline #31853 passed with stages
in 3 minutes and 5 seconds
......@@ -28,13 +28,18 @@ build_backend:
tags:
- k8s
build_frontend:
build_frontend_dev:
image: docker:latest
stage: build
script:
- sh ci/build/build_frontend.sh
variables:
VUE_APP_TITLE: "[DEV] MetageneDB"
tags:
- k8s
only:
refs:
- dev
test-backend:
image: $CI_REGISTRY_IMAGE/backend:${CI_COMMIT_REF_NAME}
......
#!/bin/sh
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# Test create .env for build stage
echo VUE_APP_GIT_COMMIT=${CI_COMMIT_SHORT_SHA} > frontend/.env
echo VUE_APP_TITLE=${VUE_APP_TITLE} >> frontend/.env
docker build -t "$CI_REGISTRY_IMAGE/frontend:${CI_COMMIT_REF_NAME}" frontend/
docker tag "$CI_REGISTRY_IMAGE/frontend:${CI_COMMIT_REF_NAME}" "$CI_REGISTRY_IMAGE/frontend:latest"
docker push "$CI_REGISTRY_IMAGE/frontend:${CI_COMMIT_REF_NAME}"
......@@ -21,8 +21,6 @@ spec:
env:
- name: NODE_ENV
value: "production"
- name: VUE_APP_GIT_COMMIT
value: ${CI_COMMIT_SHORT_SHA}
ports:
- containerPort: 80
resources:
......
......@@ -46,6 +46,7 @@ services:
environment:
NODE_ENV: development
VUE_APP_GIT_COMMIT: "local-dev-env"
VUE_APP_TITLE: "[LOC] MetageneDB"
nginx:
image: nginx:1.13.12-alpine
......
......@@ -5,7 +5,6 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>MetageneDB</title>
</head>
<body>
<noscript>
......
......@@ -9,7 +9,9 @@
</v-content>
<v-footer class="pa-3">
<v-spacer></v-spacer>
<div>Some footer (<span class="font-italic font-weight-light">{{commitHash}}</span>)</div>
<div>Metagenomics Signature group, Institut Pasteur. <span class="font-italic font-weight-light">This work is founded by <a target="_blank" href="https://www.bpifrance.fr/">bpifrance</a></span></div>
<v-spacer></v-spacer>
<span class="font-italic font-weight-light">{{commitHash}}</span>
</v-footer>
</v-app>
</template>
......@@ -29,6 +31,17 @@ export default {
commitHash() {
return process.env.VUE_APP_GIT_COMMIT;
},
}
baseTitle() {
return process.env.VUE_APP_TITLE;
}
},
created () {
document.title = this.baseTitle;
},
watch: {
'$route' (to, from) {
document.title = to.meta.title || this.baseTitle;
}
},
};
</script>
......@@ -10,6 +10,8 @@ import Home from '@/views/home/home.vue';
Vue.use(Router);
const appTitle = process.env.VUE_APP_TITLE;
export default new Router({
mode: 'history',
base: process.env.BASE_URL,
......@@ -18,6 +20,10 @@ export default new Router({
path: '/',
name: 'home',
component: Home,
meta: {
auth: true,
title: `${appTitle} - Home`,
}
},
{
path: '/compare',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment