diff --git a/.env.production b/.env.production index 06db81f7436717e981599e90b96fdd4c0e62f623..58fe7e1d7ca02bb6eb4317b4fd58c47e1acaf3bb 100644 --- a/.env.production +++ b/.env.production @@ -1 +1 @@ -VUE_APP_API="https://cce-api-dev.k8s.medina.esilab.org" +VUE_APP_API="<<CCE_API_URL>>" diff --git a/Dockerfile b/Dockerfile index 18a2c5737fad0bdd05e4bc82104c35096037984e..0b6c311e2506c994ffb2648bd579d702ed29a0a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,8 @@ RUN rm -rf /usr/share/nginx/html/* # Copy from build stage COPY --from=build-stage /app/dist /usr/share/nginx/html +COPY --from=build-stage /app/entrypoint.sh /root +RUN chmod u+x /root/entrypoint.sh EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +CMD /root/entrypoint.sh \ No newline at end of file diff --git a/README.md b/README.md index f4697bf1834c9c461e217949154c157b1b614913..f17d8a1a403ccc49bd4f894639d6e011f55eb878 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,7 @@ docker run -p 8081:80 registry-gitlab.xlab.si/medina/cce-frontend:latest Before pushing to master check if version needs to be updated in [package.json](package.json#L3). This version is also used for tagging docker image at CI. -## Setting API url +## Setting API URL -You can set the API URL in the environment file. -For local development (npm run serve) it is set in [.env.development](.env.development) and for production (docker run) in [.env.production](.env.production). -The environment must be set up before build. \ No newline at end of file +You can set the API URL using the `CCE_API_URL` environment variable. +By default (if unset) the URL used is MEDINA k8s dev deploy: https://cce-api-dev.k8s.medina.esilab.org diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..5278b11cdc1871363e318c1f731aba813c9a264d --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +URL="${CCE_API_URL:-https://cce-api-dev.k8s.medina.esilab.org}" + +sed -i "s|<<CCE_API_URL>>|${CCE_API_URL}|" /usr/share/nginx/html/js/app.*.js + +nginx -g 'daemon off;'