Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the possibility of hosting the API on docker #3577

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:current-bookworm-slim

WORKDIR /app

COPY api /app/api
COPY src /app/src
COPY themes /app/themes
COPY package-docker.json /app/package.json
COPY express.js /app/express.js
RUN cd /app
RUN npm i

CMD ["node", "express.js"]
74 changes: 74 additions & 0 deletions package-docker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "github-readme-stats",
"version": "1.0.0",
"description": "Dynamically generate stats for your GitHub readme",
"keywords": [
"github-readme-stats",
"readme-stats",
"cards",
"card-generator"
],
"main": "src/index.js",
"type": "module",
"homepage": "https://github.com/anuraghazra/github-readme-stats",
"bugs": {
"url": "https://github.com/anuraghazra/github-readme-stats/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/anuraghazra/github-readme-stats.git"
},
"scripts": {
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
"test:update:snapshot": "node --experimental-vm-modules node_modules/jest/bin/jest.js -u",
"test:e2e": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config jest.e2e.config.js",
"theme-readme-gen": "node scripts/generate-theme-doc",
"preview-theme": "node scripts/preview-theme",
"close-stale-theme-prs": "node scripts/close-stale-theme-prs",
"generate-langs-json": "node scripts/generate-langs-json",
"format": "prettier --write .",
"format:check": "prettier --check .",
"prepare": "husky install",
"lint": "npx eslint --max-warnings 0 \"./src/**/*.js\" \"./scripts/**/*.js\" \"./tests/**/*.js\" \"./api/**/*.js\" \"./themes/**/*.js\"",
"bench": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config jest.bench.config.js"
},
"author": "Anurag Hazra",
"license": "MIT",
"devDependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@testing-library/dom": "^9.3.3",
"@testing-library/jest-dom": "^6.1.5",
"@uppercod/css-to-object": "^1.1.1",
"axios-mock-adapter": "^1.22.0",
"color-contrast-checker": "^2.1.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"hjson": "^3.2.2",
"husky": "^8.0.3",
"jest": "^29.7.0",
"jest-bench": "^29.4.1",
"jest-environment-jsdom": "^29.7.0",
"js-yaml": "^4.1.0",
"lint-staged": "^15.2.0",
"lodash.snakecase": "^4.1.1",
"parse-diff": "^0.11.1",
"prettier": "^3.1.1"
},
"dependencies": {
"axios": "^1.6.2",
"dotenv": "^16.3.1",
"emoji-name-map": "^1.2.8",
"github-username-regex": "^1.0.0",
"upgrade": "^1.1.0",
"word-wrap": "^1.2.5",
"express": "^4.18.2"
},
"lint-staged": {
"*.{js,css,md}": "prettier --write"
},
"engines": {
"node": ">=18.0.0"
}
}
23 changes: 23 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Please visit [this link](https://give.do/fundraisers/stand-beside-the-victims-of
- [Deploy on your own](#deploy-on-your-own)
- [On Vercel](#on-vercel)
- [:film\_projector: Check Out Step By Step Video Tutorial By @codeSTACKr](#film_projector-check-out-step-by-step-video-tutorial-by-codestackr)
- [On Docker](#on-docker)
- [On other platforms](#on-other-platforms)
- [Disable rate limit protections](#disable-rate-limit-protections)
- [Keep your fork up to date](#keep-your-fork-up-to-date)
Expand Down Expand Up @@ -794,6 +795,28 @@ Since the GitHub API only allows 5k requests per hour, my `https://github-readme

</details>

## On Docker

> [!WARNING]\
> This way of using GRS is not officially supported. The support for this method, therefore, is limited.

> [!WARNING]\
> This method needs to have the service exposed through Your WAN IP or Domain.

> [!NOTE]\
> It is recommended to have a domain to expose the API for it to be used on a Github Profile.

<details>
<summary><b>:hammer_and_wrench: Step-by-step guide for deploying on docker</b></summary>

1. Install Docker ([docker official setup](https://docs.docker.com/engine/install/))
2. Clone this repo
3. Run `docker build -t github-readme-stats .` to build the image
4. Create a personal access token (PAT) [here](https://github.com/settings/tokens/new) and enable the `repo` and `user` permissions (this allows access to see private repo and user stats).
5. Run `docker run --name github-readme-stats -p 9000:9000 -e PAT_1=<YOUR_PERSONAL_ACCESS_TOKEN> github-readme-stats`
6. And is Done, now You can access the API via the docker machine address and the port 9000 (e.g. 192.168.1.100:9000)
</details>

## On other platforms

> [!WARNING]\
Expand Down