Defined Dockerfile & updated readme w/ running from docker

This commit is contained in:
2022-10-14 20:41:55 +02:00
parent 9e9624821e
commit 3fce8000df
2 changed files with 37 additions and 7 deletions

15
Dockerfile Normal file
View File

@@ -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"]

View File

@@ -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