Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e80dacb
initial functional docker setup for anuraghazra/github-readme-stats
digitaladapt May 24, 2024
47b3cbf
my personal setup, compose file to tie into my reverse proxy managed …
digitaladapt May 24, 2024
e7e13c3
tell watchtower not to watch, as there aren't published images to pull
digitaladapt May 25, 2024
8811f28
sorting list of networks in my compose file.
digitaladapt May 29, 2024
45edbcd
hourly health check
digitaladapt May 30, 2024
54d6e2e
ensure watchtower monitors node image, while we use a custom container.
digitaladapt May 30, 2024
368d341
enabled init, to prevent zombie processes caused by health check.
digitaladapt Jun 25, 2024
c13c03a
removing internal proxied network, that is not useful.
Sep 19, 2024
3ee3fed
merge upstream
digitaladapt May 7, 2025
e31e2f8
Merge branch 'main' into andrew
May 7, 2025
5b7ee50
merge upstream
digitaladapt May 20, 2025
b0cc052
merge upstream
digitaladapt May 20, 2025
17e3a7b
reorganized a bit
digitaladapt May 20, 2025
8fa0efe
Merge branch 'andrew-updates' into andrew
digitaladapt May 21, 2025
5b97176
merge upstream
digitaladapt May 21, 2025
f1dcc80
merge upstream
digitaladapt May 21, 2025
278ccfe
moved github username to config
digitaladapt May 21, 2025
d865ffc
Merge branch 'andrew-updates' into andrew
digitaladapt May 21, 2025
eb5b652
normalizing config across projects
digitaladapt May 22, 2025
71dbeca
added auto discovery for homepage and autokuma
digitaladapt Jul 18, 2025
c6f7365
Merge remote-tracking branch 'mirror/master' into main2
digitaladapt Nov 24, 2025
08924c9
merge upstream
digitaladapt Jan 8, 2026
65e00a4
Merge branch 'main' into andrew
digitaladapt Jan 8, 2026
8d0a4aa
merge upstream
digitaladapt Jun 14, 2026
12216a3
adding Gitea workflows to sync to GitHub and push to Docker Hub
digitaladapt Jun 14, 2026
5a3ce60
Merge branch 'main' into andrew
digitaladapt Jun 15, 2026
bb12eef
merge upstream
digitaladapt Jun 15, 2026
682c126
Merge branch 'main' into andrew
digitaladapt Jun 15, 2026
94379d9
full refactor, moving everything into docker folder, making image on …
digitaladapt Jun 17, 2026
a596d6a
standardizing gitea action files, attempting to build for arm64, and …
digitaladapt Jun 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .gitea/workflows/develop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Push Develop

on:
push:
branches:
- 'main'
- 'develop'

jobs:
docker:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
# for this project, we keep docker in its own folder, to keep it isolated from upstream
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ vars.DOCKERHUB_TARGET }}:develop

37 changes: 37 additions & 0 deletions .gitea/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Push Docker

on:
push:
tags:
- '*-*-*'
# for this project, we do "YYYY-MM-DD" for version numbers, due to unversioned upstream

jobs:
docker:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
# for this project, we keep docker in its own folder, to keep it isolated from upstream
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ vars.DOCKERHUB_TARGET }}:latest
${{ vars.DOCKERHUB_TARGET }}:${{ github.ref_name }}

37 changes: 37 additions & 0 deletions .gitea/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Sync GitHub

on:
push:
branches:
- '**'

jobs:
sync:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config --global user.name "Andrew Sync"
git config --global user.email "sync@digitaladapt.com"

- name: Add GitHub Remote
env:
SYNC_TOKEN: ${{ secrets.SYNC_GITHUB_TOKEN }}
SYNC_TARGET: ${{ vars.SYNC_GITHUB_TARGET }}
run: |
git remote add github "https://digitaladapt:${SYNC_TOKEN}@github.com/$SYNC_TARGET"

- name: Push Current Branch
run: |
git push github HEAD:${GITHUB_REF_NAME}

- name: Push Tags
run: |
git push github --tags

3 changes: 3 additions & 0 deletions docker/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Caddyfile]
indent_style = tab

6 changes: 6 additions & 0 deletions docker/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
readme-stats.example.com {
## optional, force all requests to return your github stats
#uri query username ${github_username:anuraghazra}
reverse_proxy readme_stats:${port:9000}
}

36 changes: 36 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM node:lts-alpine

# environment variables
ENV port=9000
ENV github_username=anuraghazra

# setup folder within the docker container with this app's files
WORKDIR /app
COPY ./api /app/api
COPY ./scripts /app/scripts
COPY ./src /app/src
COPY ./themes /app/themes
COPY ./express.js /app/express.js
COPY ./package.json /app/package.json
COPY ./package-lock.json /app/package-lock.json

# prepare script uses a dev-dependency, so remove it,
# move express from dev-dependency to regular dependency
# then finally install all non-dev dependencies
RUN npm pkg delete scripts.prepare \
&& npm pkg set dependencies.express="$(node -p "require('./package.json').devDependencies.express")" \
&& npm pkg delete devDependencies.express \
&& npm ci --omit=dev

# healthcheck
HEALTHCHECK --interval=60m \
--retries=3 \
--start-interval=1s \
--start-period=10s \
--timeout=5s \
CMD wget --no-verbose -O - --tries=1 "http://127.0.0.1:$port/api/?username=$github_username" | grep 'GitHub Stats' || exit 1

# start the app, on the supplied port
EXPOSE $port
CMD [ "node", "express.js" ]

28 changes: 28 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
services:
readme_stats:
container_name: readme_stats
env_file:
- .env
expose:
- $port
init: true
image: digitaladapt/github-readme-stats:latest
restart: unless-stopped

caddy:
## optional, make caddy wait until the service is ready
#depends_on:
# readme_stats:
# condition: service_healthy
## optional, make variables in .env file available to use in your Caddyfile
#env_file:
# - .env
image: caddy:lates
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro

32 changes: 32 additions & 0 deletions docker/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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.

Now as an image on Docker Hub.

**Steps to setup:**
* add the readme_stats service to your existing docker-compose.yml.
* configure your .env to have `PAT_1=<YOUR_GITHUB_TOKEN>`.
* optionally configure `port`, and `github_username`
* update your existing Caddyfile.
* and start with `docker compose up -d`.

docker-compose.yml.example, Caddyfile.example, and env.example have a very simple working example using Caddy reverse proxy.

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

10 changes: 9 additions & 1 deletion express.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ router.get("/gist", gistCard);
app.use("/api", router);

const port = process.env.PORT || process.env.port || 9000;
app.listen(port, "0.0.0.0", () => {
const server = app.listen(port, "0.0.0.0", () => {
console.log(`Server running on port ${port}`);
});

/* stop gracefully when requested */
process.on("SIGTERM", () => {
console.log("stopping, received SIGTERM signal");
server.close(() => {
process.exit();
});
});