Skip to content

#4241 Add Docker configurations #4289

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

Open
wants to merge 5 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
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -811,6 +823,19 @@ Since the GitHub API only allows 5k requests per hour, my `https://github-readme
5. You're done 🎉
</details>

## On docker platform

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

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/<pin|top-langs|wakatime|gist>?username=...`
</details>

## Disable rate limit protections

Github Readme Stats contains several Vercel environment variables that can be used to remove the rate limit protections:
Expand Down