From 9a4986ad86c8f407e50c0ab08fa6895ba60b064b Mon Sep 17 00:00:00 2001 From: Colin-de-Seroux <77831261+Colin-de-Seroux@users.noreply.github.com> Date: Sat, 3 May 2025 19:03:27 +0200 Subject: [PATCH 1/5] :wrench: Add .env example --- .env.example | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000000000..1d48f3d7a7a22 --- /dev/null +++ b/.env.example @@ -0,0 +1,8 @@ +# This file is used to set environment variables for the application. +# Copy this file to .env and fill in the values. +# Make sure to keep this file secret and do not share it publicly. + +# The port on which the application will run +PORT=9000 +# You personal access token for GitHub API access +PAT_1=ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX From 4bb1b04481033255eaa5224203314cd975c4c768 Mon Sep 17 00:00:00 2001 From: Colin-de-Seroux <77831261+Colin-de-Seroux@users.noreply.github.com> Date: Sat, 3 May 2025 19:13:08 +0200 Subject: [PATCH 2/5] :memo: Update README for add the PAT settings --- readme.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/readme.md b/readme.md index 363b008b2f8c2..3b4e72642fc61 100644 --- a/readme.md +++ b/readme.md @@ -758,6 +758,18 @@ By default, GitHub does not lay out the cards side by side. To do that, you can # Deploy on your own +## First step: get your Personal Access Token PAT + +Steps: + - Go to [Account -> Settings -> Developer Settings -> Personal access tokens -> Tokens (classic)](https://github.com/settings/tokens). + - Click on `Generate new token -> Generate new token classic`. + - Scopes to selected: + - repo + - read:user + - Click on `Generate token` and copy it. + +That's all. + ## On Vercel ### :film\_projector: [Check Out Step By Step Video Tutorial By @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107) From 60d4d5328df4894739d1854f7392363401afe726 Mon Sep 17 00:00:00 2001 From: Colin-de-Seroux <77831261+Colin-de-Seroux@users.noreply.github.com> Date: Sat, 3 May 2025 20:03:54 +0200 Subject: [PATCH 3/5] :rocket: Add docker configs --- Dockerfile | 25 +++++++++++++++++++++++++ docker-compose.yml | 13 +++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000..d1a8dd36b178c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM node:lts-alpine AS builder + +WORKDIR /app + +COPY package*.json ./ + +RUN npm i --omit=dev --ignore-scripts --no-audit + +COPY api ./api +COPY src ./src +COPY themes ./themes +COPY vercel.json ./ +COPY express.js ./ + +FROM node:lts-alpine + +WORKDIR /app + +COPY --from=builder /app /app + +RUN npm install -g dotenv-cli + +EXPOSE $port + +CMD ["dotenv", "--", "node", "express.js"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000..8df325444c8d2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +services: + + github-stats: + build: . + image: github-stats:latest + container_name: github-stats + restart: always + ports: + - "$port:$port" + env_file: + - .env + expose: + - $port From ebf68297b59c32e3b5afad6bcaeb1d8073a51291 Mon Sep 17 00:00:00 2001 From: Colin-de-Seroux <77831261+Colin-de-Seroux@users.noreply.github.com> Date: Sat, 3 May 2025 20:05:24 +0200 Subject: [PATCH 4/5] :memo: Add docker platform --- readme.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/readme.md b/readme.md index 3b4e72642fc61..63f2609c34fc6 100644 --- a/readme.md +++ b/readme.md @@ -823,6 +823,21 @@ Since the GitHub API only allows 5k requests per hour, my `https://github-readme 5. You're done 🎉 +## On docker platform + +
+ :hammer_and_wrench: Step-by-step guide for deploying on docker + + 1. Fork or clone this repo as per your needs. + 2. Add `express` to the dependencies section of `package.json` + . + 3. Copy `.env.example` in `.env`. + 4. Modify the `.env` with your PAT. + 5. Run `docker compose up -d` to start the container. + 6. You're done 🎉 + 7. Now the base URL was `http://localhost:9000/?username=...` +
+ ## Disable rate limit protections Github Readme Stats contains several Vercel environment variables that can be used to remove the rate limit protections: From 53c0e86568c47e56a12bf037d3cdffee8b196500 Mon Sep 17 00:00:00 2001 From: Colin-de-Seroux <77831261+Colin-de-Seroux@users.noreply.github.com> Date: Mon, 9 Jun 2025 20:25:50 +0200 Subject: [PATCH 5/5] :zap: Optimizing docker deployment steps No need to add by hand express --- Dockerfile | 1 + readme.md | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index d1a8dd36b178c..63133509a7bd9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ WORKDIR /app COPY package*.json ./ RUN npm i --omit=dev --ignore-scripts --no-audit +RUN npm i express COPY api ./api COPY src ./src diff --git a/readme.md b/readme.md index 63f2609c34fc6..6d4058e5f3e78 100644 --- a/readme.md +++ b/readme.md @@ -829,13 +829,11 @@ Since the GitHub API only allows 5k requests per hour, my `https://github-readme :hammer_and_wrench: Step-by-step guide for deploying on docker 1. Fork or clone this repo as per your needs. - 2. Add `express` to the dependencies section of `package.json` - . - 3. Copy `.env.example` in `.env`. - 4. Modify the `.env` with your PAT. - 5. Run `docker compose up -d` to start the container. - 6. You're done 🎉 - 7. Now the base URL was `http://localhost:9000/?username=...` + 2. Copy `.env.example` in `.env`. + 3. Modify the `.env` with your PAT. + 4. Run `docker compose up -d` to start the container. + 5. You're done 🎉 + 6. Now the base URL was `http://localhost:9000/?username=...` ## Disable rate limit protections