From 876af2ffafe9c74afac223a8f52d2489388e6248 Mon Sep 17 00:00:00 2001 From: "D. Scott Boggs" Date: Thu, 5 Oct 2023 06:15:44 -0400 Subject: [PATCH] initial commit --- Dockerfile | 7 +++++ README.md | 8 +++++ docker-compose.yml | 10 +++++++ index.html | 75 ++++++++++++++++++++++++++++++++++++++++++++++ index.js | 15 ++++++++++ shell.nix | 10 +++++++ 6 files changed, 125 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 docker-compose.yml create mode 100644 index.html create mode 100644 index.js create mode 100644 shell.nix diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..deb90cc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM node +WORKDIR /project +ADD index.html index.js /project/ +LABEL traefik.enable=true +LABEL traefik.http.routers.tws_links.rule=Host(`techwork.zone`) +LABEL traefik.http.routers.tws_links.tls.certresolver=letsencrypt +CMD [ "node", "index.js" ] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a6a3df1 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# TWS Links Page + +This is just a simple page which shows a list of links, styled after the popular +LinkTree service. It's nothing more than a static HTML page with embedded CSS which is served by a barebones node.js server. + +## Local testing + +The only dependency is Node.js, and you can work with that by just loading the HTML file in your web browser without the server. Just run `node index.js`. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9478971 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3.5' + +services: + app: + build: . + networks: [web] + +networks: + web: + external: true \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..5422dc7 --- /dev/null +++ b/index.html @@ -0,0 +1,75 @@ + + + + + + + Tech Workers' Syndicate + + + + +

Tech Workers' Syndicate

+ + + + \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..211ba0e --- /dev/null +++ b/index.js @@ -0,0 +1,15 @@ +const { readFile } = require('fs/promises') +const { Server } = require('http') + +async function main() { + const webPage = await readFile('index.html', { encoding: 'utf-8' }) + const server = new Server( + (_, res) => res.writeHead(200, {'Content-Type': 'text/html'}).end(webPage) + ) + + server.listen(1312, () => { + console.log('listening on 0.0.0.0:1312') + }) +} + +main() \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..5ae9bb8 --- /dev/null +++ b/shell.nix @@ -0,0 +1,10 @@ +# DEVELOPMENT shell environment +{ pkgs ? import {} }: + +pkgs.mkShell { + name = "TWS Links page"; + nativeBuildInputs = with pkgs.buildPackages; [ + nodejs git + ]; +} +