summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/Dockerfile18
-rw-r--r--web/default.conf.template18
-rw-r--r--web/index.php38
3 files changed, 74 insertions, 0 deletions
diff --git a/web/Dockerfile b/web/Dockerfile
new file mode 100644
index 0000000..d80a89e
--- /dev/null
+++ b/web/Dockerfile
@@ -0,0 +1,18 @@
+FROM mtg-print AS mtg-print
+FROM nginx:alpine
+
+RUN \
+ mkdir -p /var/www/html/print && \
+ mkdir -p /var/www/html/print/vendor && \
+ chmod 557 /var/www/html/print
+
+COPY --from=mtg-print \
+ /var/www/html/AllPrintings.sqlite /var/www/html/print.php \
+ /var/www/html/print/
+
+COPY --from=mtg-print \
+ /var/www/html/vendor/ \
+ /var/www/html/print/vendor/
+
+COPY default.conf.template /etc/nginx/templates/
+COPY index.php /var/www/html/
diff --git a/web/default.conf.template b/web/default.conf.template
new file mode 100644
index 0000000..888aa04
--- /dev/null
+++ b/web/default.conf.template
@@ -0,0 +1,18 @@
+server {
+ server_name localhost;
+ listen 80;
+
+ root /var/www/html;
+ index index.php;
+
+ location / {
+ try_files $uri $uri/ /index.php$query_string;
+ }
+
+ location ~ \.php$ {
+ fastcgi_pass php:9000;
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ include fastcgi_params;
+ }
+}
diff --git a/web/index.php b/web/index.php
new file mode 100644
index 0000000..2aec31f
--- /dev/null
+++ b/web/index.php
@@ -0,0 +1,38 @@
+<?php
+
+if (isset($_POST['decklist'])) {
+ $_ENV['DECKLIST'] = $_POST['decklist'];
+ include __DIR__ . '/print/print.php';
+ exit;
+}
+
+$placeholder = <<<PLCHLDR
+QUANTITY NAME (SET) NUMBER
+3 Nissa, Who Shakes the World (WAR) 169
+PLCHLDR;
+
+?>
+
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <style>
+ * {
+ box-sizing: border-box;
+ }
+ textarea {
+ max-width: 100%;
+ }
+ </style>
+ </head>
+ <body>
+ <form action="" method="POST">
+ <textarea name="decklist" placeholder="<?php echo $placeholder; ?>" rows="10" cols="40" style="max-width: 100%;" required></textarea>
+ <button>Submit</button>
+ </form>
+ <hr>
+ <a href="https://git.dweipert.de/mtg-pdf">Source</a>
+ </body>
+</html>