forked from mirrored/github-readme-stats
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a596d6a8fa | ||
|
|
94379d943e |
@@ -1,4 +1,4 @@
|
|||||||
name: Push Docker
|
name: Push Develop
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -27,6 +27,8 @@ jobs:
|
|||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
file: docker/Dockerfile
|
||||||
|
# for this project, we keep docker in its own folder, to keep it isolated from upstream
|
||||||
push: true
|
push: true
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: |
|
tags: |
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ name: Push Docker
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- '[0-9.]+-[0-9]+-[0-9]+'
|
- '*-*-*'
|
||||||
# for this project, we do "YYYY-MM-DD" for version numbers, due to unversioned upstream
|
# for this project, we do "YYYY-MM-DD" for version numbers, due to unversioned upstream
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -27,6 +27,8 @@ jobs:
|
|||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
file: docker/Dockerfile
|
||||||
|
# for this project, we keep docker in its own folder, to keep it isolated from upstream
|
||||||
push: true
|
push: true
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: |
|
tags: |
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
.vercel
|
.vercel
|
||||||
host.env
|
.env
|
||||||
node_modules
|
node_modules
|
||||||
*.lock
|
*.lock
|
||||||
.idea/
|
.idea/
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
readme-stats.example.com {
|
|
||||||
reverse_proxy readme_stats:9000
|
|
||||||
}
|
|
||||||
|
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
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" ]
|
|
||||||
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
networks:
|
|
||||||
public:
|
|
||||||
external: true
|
|
||||||
|
|
||||||
services:
|
|
||||||
readme-stats:
|
|
||||||
build: .
|
|
||||||
container_name: readme-stats
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
expose:
|
|
||||||
- ${port}
|
|
||||||
healthcheck:
|
|
||||||
test: wget --no-verbose -O - --tries=1 http://localhost:$$port/?username=$$GH_UN | grep 'GitHub Stats' || exit 1
|
|
||||||
interval: 60m # hourly
|
|
||||||
retries: 3
|
|
||||||
start_interval: 1s
|
|
||||||
start_period: 10s
|
|
||||||
timeout: 5s
|
|
||||||
init: true
|
|
||||||
labels:
|
|
||||||
- "com.centurylinklabs.watchtower.enable=false" # built, disable watchtower
|
|
||||||
- homepage.group=Sites
|
|
||||||
- homepage.name=Github Readme Stats
|
|
||||||
- homepage.icon=github
|
|
||||||
- homepage.href=https://readme.digitaladapt.com
|
|
||||||
- kuma.__docker
|
|
||||||
logging:
|
|
||||||
driver: syslog
|
|
||||||
options:
|
|
||||||
tag: readme_stats
|
|
||||||
networks:
|
|
||||||
- public
|
|
||||||
restart: always
|
|
||||||
user: ${USER_ID}:${GROUP_ID}
|
|
||||||
volumes:
|
|
||||||
- /etc/localtime:/etc/localtime:ro # read-only
|
|
||||||
|
|
||||||
# allow watchtower to monitor for update to base image, since our container is built
|
|
||||||
readme_stats_monitor:
|
|
||||||
container_name: readme_stats_monitor
|
|
||||||
entrypoint: "/bin/true"
|
|
||||||
image: node:lts-alpine
|
|
||||||
restart: no
|
|
||||||
user: ${USER_ID}:${GROUP_ID}
|
|
||||||
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[Caddyfile]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
@@ -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}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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" ]
|
||||||
|
|
||||||
@@ -1,30 +1,28 @@
|
|||||||
services:
|
services:
|
||||||
readme_stats:
|
readme_stats:
|
||||||
build: .
|
|
||||||
container_name: readme_stats
|
container_name: readme_stats
|
||||||
restart: unless-stopped
|
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
expose:
|
expose:
|
||||||
- $port
|
- $port
|
||||||
healthcheck:
|
|
||||||
test: wget --no-verbose -O - --tries=1 http://localhost:$$port/?username=$$GH_UN | grep 'GitHub Stats' || exit 1
|
|
||||||
interval: 60m # hourly
|
|
||||||
retries: 3
|
|
||||||
start_interval: 1s
|
|
||||||
start_period: 10s
|
|
||||||
timeout: 5s
|
|
||||||
init: true
|
init: true
|
||||||
|
image: digitaladapt/github-readme-stats:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
caddy:
|
caddy:
|
||||||
image: 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
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
- "443:443"
|
- "443:443"
|
||||||
- "443:443/udp"
|
- "443:443/udp"
|
||||||
depends_on:
|
|
||||||
- readme_stats
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
||||||
|
|
||||||
@@ -2,14 +2,16 @@ 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.
|
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:**
|
**Steps to setup:**
|
||||||
* clone this repo into a folder.
|
* add the readme_stats service to your existing docker-compose.yml.
|
||||||
* copy docker-compose.yml.example to docker-compose.yml.
|
* configure your .env to have `PAT_1=<YOUR_GITHUB_TOKEN>`.
|
||||||
* copy env.example to .env and update.
|
* optionally configure `port`, and `github_username`
|
||||||
* copy Caddyfile.example to Caddyfile and update.
|
* update your existing Caddyfile.
|
||||||
* and start with `docker compose up -d`.
|
* and start with `docker compose up -d`.
|
||||||
|
|
||||||
docker-compose.yml.example has a very simple Caddy reverse proxy, for automatic https.
|
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.
|
Files have example in their name, so that when you update, your local settings won't be overridden.
|
||||||
|
|
||||||
@@ -28,8 +30,3 @@ vim Caddyfile
|
|||||||
docker compose up -d
|
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.
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# github token
|
|
||||||
PAT_1=<YOUR_GITHUB_TOKEN>
|
|
||||||
# github username
|
|
||||||
GH_UN=<YOUR_GITHUB_USERNAME>
|
|
||||||
# port to listen on
|
|
||||||
port=9000
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user