https://github.com/tsertkov/docker-static-site-vars
Solution for accepting dynamic variables in statically compiled site
https://github.com/tsertkov/docker-static-site-vars
Last synced: about 2 months ago
JSON representation
Solution for accepting dynamic variables in statically compiled site
- Host: GitHub
- URL: https://github.com/tsertkov/docker-static-site-vars
- Owner: tsertkov
- Created: 2017-09-09T10:26:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-09T10:41:25.000Z (over 7 years ago)
- Last Synced: 2025-02-01T23:41:46.032Z (4 months ago)
- Language: HTML
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docker-static-site-vars
> Solution for accepting dynamic variables in a statically compiled site.
## Overview
Using `envsubst` to replace template variables in static files with corresponding environment variable values.
Configuration values are specified in `dot-env` file and passed to container by environment variables mapping in `docker-compose.yml`.
## Usage
```sh
$ docker-compose up -d
$ open http://localhost
$ docker-compose down
```## Example setup
```sh
# dot-env
VAR_1=val-1
VAR_2=val-2
``````yaml
# docker-compose.yml
version: "2"
services:
nginx:
build: .
ports:
- "80:80"
environment:
VAR_1: "${VAR_1}"
VAR_2: "${VAR_2}"```
```html
# index.html
$VAR_1=${VAR_1}
$VAR_2=${VAR_2}
```## Result (screenshot)
