From 3fce8000dfbfc008d360c36c55c91be02d402b69 Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Fri, 14 Oct 2022 20:41:55 +0200 Subject: [PATCH] Defined Dockerfile & updated readme w/ running from docker --- Dockerfile | 15 +++++++++++++++ README.md | 29 ++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eb79bec --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM node:18 + +RUN mkdir -p /opt/figlet-http/src + +WORKDIR /opt/figlet-http + +COPY src/ src +COPY package.json . +COPY yarn.lock . + +RUN yarn + +EXPOSE 3000 + +CMD ["yarn", "start"] diff --git a/README.md b/README.md index a5ffb9d..f3cdacd 100644 --- a/README.md +++ b/README.md @@ -7,25 +7,40 @@ Mostly used to generate motd message of server hostname. ## Run Install node package: + ```bash -npm install +yarn ``` -Run http server: +Start http server: + ```bash -node index.js +yarn start ``` ## Examples -Generate Larry 3D ascii response from message: +Generate Larry 3D ascii response from text: + ```bash -curl localhost:3000/ascii\?message\=hello%20world +curl localhost:3000/ascii\?text\=ragnhild ``` -Generate motd executable with message and save to file: +Generate motd executable with text and save to file: + ```bash -curl localhost:3000/motd\?message\=hello%20world > 20-hostname +curl localhost:3000/motd\?text\=ragnhild > 20-hostname +``` + +## Docker install + +Run as a docker container using: + +```bash +docker run -d \ + --name figlet-http \ + -p 3000:3000 \ + ghcr.io/kevinmidboe/figlet-http ``` ## Systemd service