Commit something which vaguely works
This commit is contained in:
commit
7885d54583
|
@ -0,0 +1,18 @@
|
||||||
|
FROM alpine:3.19
|
||||||
|
|
||||||
|
RUN apk add --no-cache nginx gettext nginx-mod-http-brotli nginx-mod-http-dav-ext nginx-mod-http-js
|
||||||
|
|
||||||
|
RUN mkdir -p /run/nginx
|
||||||
|
RUN htpasswd -b -c /etc/nginx/.htpasswd user password
|
||||||
|
|
||||||
|
COPY ./nginx.conf /etc/nginx/http.d/default.conf
|
||||||
|
COPY ./slides.js /etc/nginx/slides.js
|
||||||
|
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
|
||||||
|
|
||||||
|
ENV PUID 1000
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
STOPSIGNAL SIGKILL
|
||||||
|
|
||||||
|
CMD ["/docker-entrypoint.sh"]
|
|
@ -0,0 +1,10 @@
|
||||||
|
version: "2.3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
slides:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
volumes:
|
||||||
|
- ".:/srv"
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Update nginx user id
|
||||||
|
deluser nginx
|
||||||
|
adduser -u $PUID -D nginx
|
||||||
|
|
||||||
|
exec nginx -g "daemon off;"
|
|
@ -0,0 +1,59 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
root /srv;
|
||||||
|
|
||||||
|
access_log /dev/stdout;
|
||||||
|
error_log /dev/stderr;
|
||||||
|
|
||||||
|
keepalive_timeout 65;
|
||||||
|
sendfile_max_chunk 1m;
|
||||||
|
|
||||||
|
gzip_static off;
|
||||||
|
gzip on;
|
||||||
|
gzip_types *;
|
||||||
|
|
||||||
|
# brotli
|
||||||
|
brotli on;
|
||||||
|
brotli_static on;
|
||||||
|
|
||||||
|
# IP detection
|
||||||
|
set_real_ip_from 0.0.0.0/0;
|
||||||
|
real_ip_header X-Forwarded-For;
|
||||||
|
|
||||||
|
index index.html;
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
|
||||||
|
error_page 403 =404 /404.html;
|
||||||
|
|
||||||
|
# Kick malicious clients sooner
|
||||||
|
client_header_timeout 10s;
|
||||||
|
client_body_timeout 10s;
|
||||||
|
client_max_body_size 128k;
|
||||||
|
reset_timedout_connection on;
|
||||||
|
|
||||||
|
# Expose WebDAV on a sub-path
|
||||||
|
location /.dav/ {
|
||||||
|
alias /srv/;
|
||||||
|
|
||||||
|
auth_basic_user_file /etc/nginx/.htpasswd;
|
||||||
|
auth_basic "Restricted";
|
||||||
|
|
||||||
|
dav_methods PUT DELETE MKCOL COPY MOVE;
|
||||||
|
dav_ext_methods PROPFIND OPTIONS;
|
||||||
|
min_delete_depth 1;
|
||||||
|
|
||||||
|
client_body_temp_path /tmp;
|
||||||
|
create_full_put_path on;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Healthcheck endpoint
|
||||||
|
location /.ping {
|
||||||
|
access_log off;
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
js_import slides.js;
|
||||||
|
location = /sitemap.xml {
|
||||||
|
js_content slides.sitemap;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:base"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
function sitemap(r) {
|
||||||
|
const directories = fs.readdirSync("/srv")
|
||||||
|
.map(f => [f, fs.statSync(`/srv/${f}`)])
|
||||||
|
.filter(d => d[1].isDirectory())
|
||||||
|
.map(d => {
|
||||||
|
const directoryName= d[0];
|
||||||
|
const stats = d[1];
|
||||||
|
const modifiedTime = new Date(stats.mtime);
|
||||||
|
return `<url><loc>https://slides.theorangeone.net/${directoryName}/</loc><lastmod>${modifiedTime.toISOString().split("T")[0]}</lastmod></url>`;
|
||||||
|
});
|
||||||
|
|
||||||
|
const sitemapData = `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||||
|
${directories.join('')}
|
||||||
|
</urlset>
|
||||||
|
`.replace("\n", "");
|
||||||
|
|
||||||
|
r.headersOut["content-type"] = "application/xml";
|
||||||
|
|
||||||
|
r.return(200, sitemapData);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {sitemap};
|
Loading…
Reference in New Issue