diff --git a/.env.development b/.env.development new file mode 100644 index 0000000000000000000000000000000000000000..21311a48aa4b4b09084c962e220b2b4aa6429206 --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +VUE_APP_API_URL=http://localhost:8080/ \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000000000000000000000000000000000000..60dfd13205c2dbfa3a03b83954ada0ac7a9377b2 --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +VUE_APP_API_URL=http://backend:8080/ \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b719255fe64f859d670e03c054d7afb73fc70ba..29f44df45dc5e19d89ad508dfb2c19536a85195b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,5 +36,5 @@ deploy_docker: - apt-get -yqq install ssh - apt-get install sshpass script: - - sshpass -p sParest1en ssh -v -o StrictHostKeyChecking=no root@128.199.53.153 "docker rm -f frontend || true; docker pull registry.gitlab.com/$DOCKER_USER/sparesti-registry:frontend && docker run -d -p 81:80 --name frontend registry.gitlab.com/$DOCKER_USER/sparesti-registry:frontend" + - sshpass -p sParest1en ssh -v -o StrictHostKeyChecking=no root@128.199.53.153 "docker rm -f frontend || true; docker pull registry.gitlab.com/$DOCKER_USER/sparesti-registry:frontend && docker run -d -p 81:80 --build-arg VUE_APP_API_URL=http://backend:8080/ --name frontend registry.gitlab.com/$DOCKER_USER/sparesti-registry:frontend" when: manual \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 71a251d8614879bdb36d6b110be330286450e30c..87dec688ab9ab69c346562ce07de9bacacea6f08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,9 @@ WORKDIR /app COPY package*.json ./ RUN npm install COPY . . -ENV API_URL=backend:80 +#ENV API_URL=http://backend:8080 +ARG VUE_APP_API_URL +ENV VUE_APP_API_URL $VUE_APP_API_URL RUN npm run build # Step 2: Setup the server with Nginx diff --git a/src/App.vue b/src/App.vue index a3b2637e96abb4454f949e47dcdf04c9155e4695..ff13e635c87d60ddef5ece81a583151872e72ec1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,7 +2,8 @@ import { RouterView } from 'vue-router' import ErrorBoundaryCatcher from '@/components/Exceptions/ErrorBoundaryCatcher.vue'; console.log("TEST!"); -console.log("env: ", process.env.API_URL); +let apiUrl = import.meta.env.VUE_APP_API_URL; +console.log("apiUrl: ", apiUrl); </script> <template>