Defined Dockerfile & updated readme w/ running from docker
This commit is contained in:
15
Dockerfile
Normal file
15
Dockerfile
Normal 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"]
|
||||||
29
README.md
29
README.md
@@ -7,25 +7,40 @@ Mostly used to generate motd message of server hostname.
|
|||||||
## Run
|
## Run
|
||||||
|
|
||||||
Install node package:
|
Install node package:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install
|
yarn
|
||||||
```
|
```
|
||||||
|
|
||||||
Run http server:
|
Start http server:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
node index.js
|
yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
Generate Larry 3D ascii response from message:
|
Generate Larry 3D ascii response from text:
|
||||||
|
|
||||||
```bash
|
```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
|
```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
|
## Systemd service
|
||||||
|
|||||||
Reference in New Issue
Block a user