summaryrefslogtreecommitdiff
path: root/docker/server
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-11-12 11:16:56 +0100
committerDaniel Weipert <code@drogueronin.de>2023-11-20 17:30:04 +0100
commit6df3d321d9b67c4541f50158b087d37c4b22e886 (patch)
tree06031988bb4b957b76f051af366ced448a48545f /docker/server
initial commit
Diffstat (limited to 'docker/server')
-rw-r--r--docker/server/Dockerfile13
-rw-r--r--docker/server/server.php19
2 files changed, 32 insertions, 0 deletions
diff --git a/docker/server/Dockerfile b/docker/server/Dockerfile
new file mode 100644
index 0000000..7f37ef4
--- /dev/null
+++ b/docker/server/Dockerfile
@@ -0,0 +1,13 @@
+FROM php:alpine
+
+COPY --from=composer /usr/bin/composer /usr/bin/composer
+
+WORKDIR /usr/src/app
+
+COPY composer.json .
+COPY src src
+RUN composer install
+
+COPY docker/server/server.php .
+
+CMD ["php", "./server.php"]
diff --git a/docker/server/server.php b/docker/server/server.php
new file mode 100644
index 0000000..dee0cd8
--- /dev/null
+++ b/docker/server/server.php
@@ -0,0 +1,19 @@
+<?php
+
+use GeminiFoundation\Server;
+use GeminiFoundation\Server\RequestHandlers\DocumentServer;
+
+require __DIR__ . '/vendor/autoload.php';
+
+$server = new Server(
+ [
+ 'file' => __DIR__ . '/certificate/cert.pem',
+ 'key' => __DIR__ . '/certificate/key.rsa',
+ 'passphrase' => '',
+ ],
+ '0.0.0.0'
+);
+
+$server->onRequest(new DocumentServer(__DIR__ . '/content'));
+
+$server->listen();