Required-runtime-static-html
required-runtime-static-html is a small cli tool that can be used to inject a <script>
tag into the head of a static file
Docker
Docker is a great tool for building an immutable container which can be used in multiple environments with different environment variables.
Unfortunately static websites do not get this benefit unless you do some fancy tricks
required-runtime-static-html solves this by having the container modify its contents itself on startup, keeping the overall container immutable
Simply change your start script to include required-runtime-static-html
startup.sh
required-runtime-static-html ./public/index.html --required=KEY1,KEY2,KEY3
** The ENTRYPOINT/CMD of your application **
``
Dockerfile
RUN npm install -g required-runtime-static-html CMD ["startup.sh"]