Skip to content

tamland/spa-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Runtime configuration of Single Page Apps

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages