Files
slipmatz-web/GHCR-AUTH.md
2025-11-27 00:12:35 +08:00

66 lines
1.3 KiB
Markdown

# Login to GitHub Container Registry (GHCR)
## On the Server
### 1. Create GitHub Personal Access Token
Go to: https://github.com/settings/tokens
Click "Generate new token (classic)"
Select scopes:
-`read:packages` (required)
-`write:packages` (if you need to push)
Copy the token (starts with `ghp_`)
### 2. Login to GHCR
```bash
# On your server
echo YOUR_GITHUB_TOKEN | docker login ghcr.io -u franknstayn --password-stdin
```
Or export as environment variable:
```bash
export GITHUB_TOKEN=ghp_your_token_here
echo $GITHUB_TOKEN | docker login ghcr.io -u franknstayn --password-stdin
```
### 3. Pull the image
```bash
cd crew-infrastructure
docker compose pull slipmatz_web
docker compose up -d slipmatz_web
```
## Make Package Public (Alternative - No Auth Required)
If you want to avoid authentication:
1. Go to: https://github.com/franknstayn?tab=packages
2. Click on `slipmatz-web` package
3. Package settings (right sidebar)
4. "Change visibility" → Select "Public"
5. Confirm
Then you can pull without login:
```bash
docker compose pull slipmatz_web
```
## Recommended for Production
Store credentials securely:
```bash
# On server, add to ~/.bashrc or ~/.zshrc
export GITHUB_TOKEN=ghp_your_token_here
# Add to docker-compose.yml env
echo "GITHUB_TOKEN=$GITHUB_TOKEN" >> .env
```
Or use docker credential helper for permanent storage.