initial functional docker setup for anuraghazra/github-readme-stats

This commit is contained in:
2024-05-24 11:31:48 -04:00
parent 7a78036e3f
commit e80dacb176
6 changed files with 89 additions and 1 deletions
+4
View File
@@ -0,0 +1,4 @@
readme-stats.example.com {
reverse_proxy readme_stats:9000
}
+13
View File
@@ -0,0 +1,13 @@
FROM node:lts-alpine
# setup folder within the docker container with this app's files
WORKDIR /app
COPY . .
# add express.js as dependency and download node modules
RUN npm install express.js
# start the app, on the supplied port
EXPOSE $port
CMD [ "node", "express.js" ]
+22
View File
@@ -0,0 +1,22 @@
services:
readme_stats:
build: .
container_name: readme_stats
restart: unless-stopped
env_file:
- .env
expose:
- $port
caddy:
image: caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "443:443/udp"
depends_on:
- readme_stats
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
+5
View File
@@ -0,0 +1,5 @@
# github token
PAT_1=<YOUR_GITHUB_TOKEN>
# port to listen on
port=9000
+10 -1
View File
@@ -7,7 +7,16 @@ import gistCard from "./api/gist.js";
import express from "express";
const app = express();
app.listen(process.env.port || 9000);
const server = app.listen(process.env.port || 9000);
console.log("started, awaiting requests");
/* stop gracefully when requested */
process.on("SIGTERM", () => {
console.log("stopping, received SIGTERM signal");
server.close(() => {
process.exit();
});
});
app.get("/", statsCard);
app.get("/pin", repoCard);
+35
View File
@@ -0,0 +1,35 @@
Get dynamically generated GitHub stats on your READMEs, with the ease of docker!
Fork of [https://github.com/anuraghazra/github-readme-stats](https://github.com/anuraghazra/github-readme-stats), gently wrapped in docker.
**Steps to setup:**
* clone this repo into a folder.
* copy docker-compose.yml.example to docker-compose.yml.
* copy env.example to .env and update.
* copy Caddyfile.example to Caddyfile and update.
* and start with `docker compose up -d`.
docker-compose.yml.example has a very simple Caddy reverse proxy, for automatic https.
Files have example in their name, so that when you update, your local settings won't be overridden.
```
git clone https://code.digitaladapt.com/andrew/github-readme-stats.git
cd github-readme-stats
cp docker-compose.yml.example docker-compose.yml
cp env.example .env
vim .env
# add your github token
cp Caddyfile.example Caddyfile
vim Caddyfile
# configure your domain
docker compose up -d
```
You might ask, why should I trust your docker image?
The answer is, you don't have to, there isn't an image,
just a few commands in the Dockerfile, which you can and should look at.