diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..6557406
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,4 @@
+.git
+.github
+.idea
+vendor
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 4798b3a..06c748e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
img/bg.*
Gemfile.lock
-composer.lock
+_api/composer.lock
vendor/
.bundle
_site
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..f750a93
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,67 @@
+FROM alpine
+
+###
+# Jekyll
+###
+
+# Install Jekyll dependencies
+RUN apk add --no-cache build-base libxml2-dev libxslt-dev ruby-full ruby-dev gcc linux-headers
+
+# Copy Jekyll files
+RUN adduser -D -u 1000 -h /tmp/www www
+COPY --chown=www:www jekyll /tmp/jekyll
+WORKDIR /tmp/jekyll
+
+USER www
+
+# Install gems
+RUN bundle config build.nokogiri --use-system-libraries
+RUN bundle config set path 'vendor/bundle'
+RUN bundle install
+
+# Build site
+RUN bundle exec jekyll build
+
+USER root
+RUN mv _site /opt/www/
+
+# Remove Jekyll dependencies
+RUN apk del build-base libxml2-dev libxslt-dev ruby-full ruby-dev gcc linux-headers
+
+###
+# PHP
+###
+
+# Install PHP dependencies
+RUN apk add --no-cache php-fpm php-curl php-json php-session composer
+
+# Set up PHP-FPM
+COPY php-install.sh /
+RUN chmod +x /php-install.sh; /bin/sh /php-install.sh; rm /php-install.sh
+
+# Copy PHP files
+COPY ./php /opt/php
+WORKDIR /opt/php
+
+# Install libraries
+RUN composer install --no-dev
+
+RUN apk del composer
+
+###
+# Nginx
+###
+
+# Install Nginx
+RUN apk add --no-cache nginx
+
+# Copy Nginx virtual server config
+COPY ./nginx.conf /etc/nginx/conf.d/default.conf
+
+# Bug fixes
+RUN mkdir /run/nginx
+RUN sed -i 's/cgi.fix_pathinfo= 0/cgi.fix_pathinfo=1/g' /etc/php7/php.ini
+ONBUILD RUN chown www:www /opt/www/ -R
+
+EXPOSE 80
+CMD php-fpm7 && nginx; tail -F /var/log/nginx/error.log
\ No newline at end of file
diff --git a/Gemfile b/Gemfile
deleted file mode 100644
index bd8098a..0000000
--- a/Gemfile
+++ /dev/null
@@ -1,6 +0,0 @@
-source 'https://rubygems.org'
-
-
-group :jekyll_plugins do
- gem 'github-pages'
-end
diff --git a/README.md b/README.md
index 4785009..8463cab 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,28 @@
-# Unify Guest Portal
+# UniFi Guest Portal
+
+## Usage
+
+```BASH
+docker run -p 80:80 carlgo11/guest-portal
+```
+
+Optionally, add some background images:
+
+```BASH
+docker run -p 80:80 -v $(pwd)/bg.webp:/opt/www/img/bg.webp -v $(pwd)/bg.jpg:/opt/www/img/bg.jpg carlgo11/guest-portal
+```
+
+## Environment variables
+
+|Name|Default|Description|Example|
+|----|-------|-----------|-------|
+|UNIFI_USER| |UniFi Hotspot username|api
+|UNIFI_PASSWORD| |UniFi Hotspot password|password
+|UNIFI_URL| |UniFi Controller IP/URL & port|https://192.168.1.2:8443
+|UNIFI_SITE|default|UniFi Site|default
+|UNIFI_VERSION| |Controller version|5.13.32
## License
This work is licensed under the Creative Commons Attribution 4.0 International License.
-To view a copy of this license, visit [LICENSE](LICENSE).
\ No newline at end of file
+To view a copy of this license, visit [LICENSE](LICENSE).
diff --git a/_api/submit.php b/_api/submit.php
deleted file mode 100644
index de15d74..0000000
--- a/_api/submit.php
+++ /dev/null
@@ -1,44 +0,0 @@
- "Invalid mac address", 'success' => FALSE], JSON_PRETTY_PRINT));
- return;
-}
-
-$unifi_connection = new UniFi_API\Client($_ENV['hotspot_user'], $_ENV['hotspot_password'], $_ENV['unifi_url'], $_ENV['unifi_site'], $_ENV['unifi_version'], FALSE);
-$login = $unifi_connection->login();
-$vouchers = $unifi_connection->stat_voucher();
-
-if (isset($code)) {
- foreach ($vouchers as $voucher) {
- $voucher = get_object_vars($voucher);
- if ($voucher['code'] == $code) {
- $max_up = NULL;
- $max_down = NULL;
- $usage_quota = NULL;
- if (isset($voucher['qos_rate_max_up'])) $max_up = $voucher['qos_rate_max_up'];
- if (isset($voucher['qos_rate_max_down'])) $max_down = $voucher['qos_rate_max_down'];
- if (isset($voucher['qos_usage_quota'])) $usage_quota = $voucher['qos_usage_quota'];
-
- $authorized = $unifi_connection->authorize_guest($mac, $voucher['duration'], $max_up, $max_down, $usage_quota, $ap_mac);
- $unifi_connection->revoke_voucher($voucher['_id']);
- header('Status: 202');
- print(json_encode(['success' => TRUE], JSON_PRETTY_PRINT));
- return;
- }
- }
-}
-
-header('Status: 400');
-print(json_encode(['success' => FALSE, 'error' => 'Voucher code not found'], JSON_PRETTY_PRINT));
-return;
diff --git a/jekyll/Gemfile b/jekyll/Gemfile
new file mode 100644
index 0000000..ab38815
--- /dev/null
+++ b/jekyll/Gemfile
@@ -0,0 +1,3 @@
+source 'https://rubygems.org'
+
+gem 'jekyll'
\ No newline at end of file
diff --git a/_config.yml b/jekyll/_config.yml
similarity index 94%
rename from _config.yml
rename to jekyll/_config.yml
index 98a4cc4..9be6f8f 100644
--- a/_config.yml
+++ b/jekyll/_config.yml
@@ -1,9 +1,9 @@
-theme: null
-exclude:
- - vendor/bundle
- - vendor/cache
- - .bundle
- - .gitignore
- - composer.json
- - Gemfile
+theme: null
+exclude:
+ - vendor/bundle
+ - vendor/cache
+ - .bundle
+ - .gitignore
+ - composer.json
+ - Gemfile
- README.md
\ No newline at end of file
diff --git a/_includes/approval.html b/jekyll/_includes/approval.html
similarity index 97%
rename from _includes/approval.html
rename to jekyll/_includes/approval.html
index 4abe313..9caf239 100644
--- a/_includes/approval.html
+++ b/jekyll/_includes/approval.html
@@ -1,11 +1,11 @@
-
-
-
-
- Loading...
-
-
-
Back
-
Waiting for
- approval...
+
+
+
+
+ Loading...
+
+
+
Back
+
Waiting for
+ approval...
\ No newline at end of file
diff --git a/_includes/error.html b/jekyll/_includes/error.html
similarity index 97%
rename from _includes/error.html
rename to jekyll/_includes/error.html
index ac6dffe..0c4a3d8 100644
--- a/_includes/error.html
+++ b/jekyll/_includes/error.html
@@ -1,8 +1,8 @@
-
-
-
Back
-
-
-
Error:
-
+
+
+
Back
+
+
+
Error:
+
\ No newline at end of file
diff --git a/_includes/form.html b/jekyll/_includes/form.html
similarity index 92%
rename from _includes/form.html
rename to jekyll/_includes/form.html
index a959e67..304347f 100644
--- a/_includes/form.html
+++ b/jekyll/_includes/form.html
@@ -1,19 +1,19 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/_includes/loading.html b/jekyll/_includes/loading.html
similarity index 96%
rename from _includes/loading.html
rename to jekyll/_includes/loading.html
index 2b7524d..08a5692 100644
--- a/_includes/loading.html
+++ b/jekyll/_includes/loading.html
@@ -1,9 +1,9 @@
-
-
-
Communicating with network...
-
-
- Loading...
-
-
+
+
+
Communicating with network...
+
+
+ Loading...
+
+
\ No newline at end of file
diff --git a/_includes/success.html b/jekyll/_includes/success.html
similarity index 96%
rename from _includes/success.html
rename to jekyll/_includes/success.html
index f470259..81c9abd 100644
--- a/_includes/success.html
+++ b/jekyll/_includes/success.html
@@ -1,4 +1,4 @@
-
-
-
Welcome! 😄
+
+
+
Welcome! 😄
\ No newline at end of file
diff --git a/_layouts/default.html b/jekyll/_layouts/default.html
similarity index 97%
rename from _layouts/default.html
rename to jekyll/_layouts/default.html
index fd36e5c..faadd71 100644
--- a/_layouts/default.html
+++ b/jekyll/_layouts/default.html
@@ -1,26 +1,26 @@
-
-
-
-
-
- Guest WiFi
-
-
-
-
-
-
-
-
-
-