It's an axample for article: Vite, Nginx and environment variables for a static website at runtime
- Create
.envfilecp .env.example .env
- Install node_modules
npm i
- Build the Docker image
docker build -t vite-nginx-dynamic-env-variables-example . - Run the image with environment variable
VITE_VERSION=FROM_NGINXdocker run -p 81:80 -e VITE_VERSION=FROM_NGINX vite-nginx-dynamic-env-variables-example
- Open http://127.0.0.1:81 and see the result