From b59e7567dbf96b8452c7618093e6adbd8f71cc4d Mon Sep 17 00:00:00 2001
From: Richard Mannweiler <rm3927@bingo-ev.de>
Date: Tue, 12 Mar 2019 21:51:23 +0100
Subject: [PATCH] add docker support

---
 .docker/nginx-vhost.conf | 20 ++++++++++++++++++++
 .gitignore               |  1 +
 Dockerfile               |  9 +++++++++
 README.md                |  8 ++++++++
 4 files changed, 38 insertions(+)
 create mode 100644 .docker/nginx-vhost.conf
 create mode 100644 Dockerfile

diff --git a/.docker/nginx-vhost.conf b/.docker/nginx-vhost.conf
new file mode 100644
index 0000000..4471349
--- /dev/null
+++ b/.docker/nginx-vhost.conf
@@ -0,0 +1,20 @@
+server {
+    listen       80;
+    server_name  localhost;
+
+    location / {
+        root   /usr/share/nginx/html;
+        index  index.html index.htm;
+    }
+
+    location ~ /\.docker {
+        deny  all;
+    }
+
+    location /images {
+        alias /images;
+        autoindex on;
+    }
+}
+
+
diff --git a/.gitignore b/.gitignore
index c321e79..775b13f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
+*.swp
 config.js
 images/*
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..b16ab61
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,9 @@
+FROM nginx:alpine
+
+COPY . /usr/share/nginx/html/
+COPY .docker/nginx-vhost.conf /etc/nginx/conf.d/default.conf 
+
+HEALTHCHECK --interval=1m --timeout=10s \
+	CMD nc -z localhost 80 
+
+VOLUME ["/images"]
diff --git a/README.md b/README.md
index 5bd0858..764d01c 100644
--- a/README.md
+++ b/README.md
@@ -31,6 +31,14 @@ location /path/to/builds/ {
 #### Python Webserver
 For testing purposes or to share files in a LAN, Python can be used. Run `python -m http.server 8080` from within this directory (the directory where `README.md` can be found) and you are done.
 
+#### Docker
+```
+docker build -t gluon-firmware-selector .
+docker run -p 80:80 -v /path/to/firmware/:/images:ro -v /path/to/config.js:/usr/share/nginx/html/config.js:ro --name web_firmware gluon-firmware-selector
+```
+For https support check [jrcs/letsencrypt-nginx-proxy-companion](https://hub.docker.com/r/jrcs/letsencrypt-nginx-proxy-companion)
+
+
 ### List of available router models
 All available router models are specified in `devices.js` via that will match against the filenames.
 If no hardware revision is given or is it is empty, the revision is extracted from the file name.
-- 
GitLab