vladimirlogachev / elm-land-docker-example

Assets caching, Docker setup, app configured at runtime

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Elm Land Docker Example

Elm Land Docker Example

Features

  • Assets caching (set up in container too)
  • Docker build (can be deployed in private environment)
  • Application is configured at runtime via environment variables:
    • Application config
    • Whether or not to allow indexing (robots.txt)
  • Deployment can be done without accessing the source code (Docker image doesn't contain any sources, and customer can parametrize the app via environment variables and deploy wherever they want)

Prerequisites

  • NPM
  • Docker

Local development (without Docker)

Docker

  • Build and run Docker container

    docker build -t elm-land-docker-example . &&
      docker container run \
        -p 1234:80 \
        -e WEBAPP_ALLOW_INDEXING="true" \
        -e WEBAPP_BACKEND_URL="https://en.wikipedia.org/api" \
        elm-land-docker-example
  • Open http://localhost:1234

How to add new env variables:

  • public/nocache/config.json (and set default value for local development)
  • configs/nginx.on-startup.sh (see the end of file)
  • src/Shared/Config.elm (decode and use new values in your Elm app)

About

Assets caching, Docker setup, app configured at runtime


Languages

Language:Elm 50.3%Language:CSS 20.5%Language:TypeScript 9.9%Language:HTML 8.7%Language:Dockerfile 5.8%Language:Shell 4.8%