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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000..63133509a7bd9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM node:lts-alpine AS builder + +WORKDIR /app + +COPY package*.json ./ + +RUN npm i --omit=dev --ignore-scripts --no-audit +RUN npm i express + +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 diff --git a/readme.md b/readme.md index 363b008b2f8c2..6d4058e5f3e78 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) @@ -811,6 +823,19 @@ 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. 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 Github Readme Stats contains several Vercel environment variables that can be used to remove the rate limit protections: