# Build your Docker image
docker build -t my-app:latest .
# Tag for GHCR
docker tag my-app:latest ghcr.io/your-username/my-app:latest
# Login to GHCR
echo "YOUR_PAT" | docker login ghcr.io -u YOUR_USERNAME --password-stdin
# Push to GHCR
docker push ghcr.io/your-username/my-app:latest
2. Pull and Run Containerโผ
# Pull from GHCR
docker pull ghcr.io/your-username/my-app:latest
# Run the container
docker run -p 8080:80 ghcr.io/your-username/my-app:latest
Pro Tip: Use GitHub Actions to automate your container builds!
3. Deploy on Railway Cloud (from GHCR)โผ
# 1๏ธโฃ Login to Railway
railway login
# 2๏ธโฃ Link your GitHub repository
railway link
# 3๏ธโฃ Add your GHCR image in Railway settings
# (In Dashboard โ Deployments โ New Deployment โ Deploy from Docker Image)
# Example:
ghcr.io/your-username/my-app:latest
# 4๏ธโฃ Set PORT (important for FastAPI, Flask etc.)
railway variables set PORT=8000
# 5๏ธโฃ Deploy the container
railway up
# โ Once deployed, Railway provides a live link such as:
https://my-app.up.railway.app
# ๐ Youโve successfully deployed a GHCR container on Railway Cloud!
Result: Your FastAPI / Flask / Node.js container hosted on Railway Cloud
with a live link automatically generated from your GHCR image!