Browse Source

Merge branch 'static' into 'master'

add static site based on nginx

See merge request oxyta.net/docker-atelier!14
Guilhem Saurel 6 years ago
parent
commit
9b64ee16ac
2 changed files with 41 additions and 0 deletions
  1. 23 0
      static/README.md
  2. 18 0
      static/docker-compose.yml

+ 23 - 0
static/README.md

@@ -0,0 +1,23 @@
+# Static site
+
+## Configure
+To serve a static site for `changeme.domain.tld`:
+```
+echo CHATONS_STATIC_SITE=changeme >> .env
+echo CHATONS_DOMAIN=domain.tld >> .env
+```
+
+## Deploy
+```
+docker-compose up -d
+```
+
+You just need to copy your static site content to:
+```
+/srv/chatons/static/changeme
+```
+
+Then ensure that read access to /srv/chatons/static/changeme files and folders is given to everybody as the nginx user needs to see them
+
+Now you have a static site at URL `changeme.localhost` or `changeme.${CHATONS_DOMAIN}`
+

+ 18 - 0
static/docker-compose.yml

@@ -0,0 +1,18 @@
+version: '3'
+
+networks:
+  web:
+    external: true
+
+services:
+  web:
+    image: nginx:alpine
+    restart: unless-stopped
+    volumes:
+      - ${CHATONS_ROOT_DIR:-/srv/chatons}/static/${CHATONS_STATIC_SITE:-static}:/usr/share/nginx/html:ro
+    labels:
+      traefik.enable: "true"
+      traefik.frontend.rule: "Host: ${CHATONS_STATIC_SITE:-static}.${CHATONS_DOMAIN:-localhost}, www.${CHATONS_STATIC_SITE:-static}.${CHATONS_DOMAIN:-localhost}"
+    networks:
+      - web
+