npm install
npm run serve -- --port 8081
npm run test:unit
npm run lint
The production environment is based on serving the app through a dockerized nginx server.
It is always recommended to pull the docker image from the remote container registry, rather than building the image on the production machine
docker-compose -f docker-compose.yml -f docker-compose.prod.yml pull
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
- The node server (i.e. running the project outside of a container with
npm run serve
) cannot be used in production. The problem is about a lack of configuration of the plain node server that makes it unreachable from the outside. This is where the usage of nginx becomes irreplaceable. - In order to test bugfixes, the only way is to modify the code and rebuild the image in the dev environment containerized configuration.
This has to be used only for bugfixes on the containerized image that will be then used for production
docker-compose build
Note: dev mode here replicates the production environment, since this configuration purpose is to debug the deployed application. The only change here is the image name, which is used to differentiate this image from the official prod image from the container registry on gitlab.
docker-compose up -d
Simply declare your variables in .env
file
Variables must follow the naming convention: VITE_VARIABLE_NAME New variables are only seen upon Node Server restart
Since production code is precompiled, variables cannot be easily changed on-the-fly. This project follows a strategy presented in https://medium.com/js-dojo/vue-js-runtime-environment-variables-807fa8f68665
The idea is to use the entrypoint to look for regular expressions coinciding with env vars names and substitute them with values coming from the .env file.
Each new variable needed in the project requires a new image build. For already existing variables, on the other hand, the value can be changed within .env*
files and it is immediately reflected upon container restart.
Make sure to add the script placeholder in public/index.html otherwise the env vars compilation will not end up in the final js code