Sign inSign up

tamland/spa-server

By tamland

•Updated almost 9 years ago

Runtime configuration of Single Page Apps

Image
0

478

tamland/spa-server repository overview

⁠SPA server

Nginx docker image for runtime configuration of Single Page Apps via environment variables.

⁠Example usage

index.html

<html>
  <head>
    <script type=text/javascript src="/env.js"></script>
  </head>
  <body>
    <p id="app"></p>
    <script>
      document.getElementById("app").innerHTML = window._env.MSG1 + " " + window._env.MSG2;
    </script>
  </body>
</html>

Dockerfile

FROM tamland/spa-server

ENV EXPOSE_VARS="MSG1 MSG2"
COPY index.html /var/www/html/

Start

$ docker run -p 8080:80 -e MSG1=Hello -e MSG2=world helloworld:latest

Tag summary

Content type

Image

Digest

Size

6.4 MB

Last updated

almost 9 years ago

docker pull tamland/spa-server