Tantawi65 commited on
Commit ·
4735fad
1
Parent(s): a7b6b46
Deploy Khofo Card Game
Browse files- .gitattributes +35 -0
- Dockerfile +34 -0
- deploy.md +134 -6
- readme.md +26 -1
.gitattributes
CHANGED
|
@@ -1,2 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
*.png filter=lfs diff=lfs merge=lfs -text
|
| 2 |
client/public/Assests/*.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
*.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
client/public/Assests/*.png filter=lfs diff=lfs merge=lfs -text
|
Dockerfile
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:18-alpine
|
| 2 |
+
|
| 3 |
+
# Create app user (required by HF Spaces)
|
| 4 |
+
RUN addgroup -g 1000 appgroup && adduser -u 1000 -G appgroup -D appuser
|
| 5 |
+
|
| 6 |
+
WORKDIR /app
|
| 7 |
+
|
| 8 |
+
# Copy package files
|
| 9 |
+
COPY client/package*.json ./client/
|
| 10 |
+
COPY server/package*.json ./server/
|
| 11 |
+
|
| 12 |
+
# Install dependencies
|
| 13 |
+
RUN cd client && npm install
|
| 14 |
+
RUN cd server && npm install
|
| 15 |
+
|
| 16 |
+
# Copy source code
|
| 17 |
+
COPY . .
|
| 18 |
+
|
| 19 |
+
# Build client and server
|
| 20 |
+
RUN cd client && npm run build
|
| 21 |
+
RUN cd server && npm run build
|
| 22 |
+
|
| 23 |
+
# Change ownership
|
| 24 |
+
RUN chown -R appuser:appgroup /app
|
| 25 |
+
|
| 26 |
+
# Switch to non-root user
|
| 27 |
+
USER appuser
|
| 28 |
+
|
| 29 |
+
# Hugging Face Spaces uses port 7860, Render/Railway use PORT env
|
| 30 |
+
ENV PORT=7860
|
| 31 |
+
EXPOSE 7860
|
| 32 |
+
|
| 33 |
+
# Start server
|
| 34 |
+
CMD ["node", "server/dist/index.js"]
|
deploy.md
CHANGED
|
@@ -7,9 +7,10 @@ This guide covers multiple ways to deploy your Mummy Card Game for use outside l
|
|
| 7 |
## Table of Contents
|
| 8 |
1. [Quick Deploy with Render (Recommended)](#option-1-render-recommended---free)
|
| 9 |
2. [Deploy with Railway](#option-2-railway)
|
| 10 |
-
3. [Deploy with
|
| 11 |
-
4. [Deploy with
|
| 12 |
-
5. [
|
|
|
|
| 13 |
|
| 14 |
---
|
| 15 |
|
|
@@ -211,7 +212,134 @@ Railway offers simple deployment with generous free tier.
|
|
| 211 |
|
| 212 |
---
|
| 213 |
|
| 214 |
-
## Option 3:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
|
| 216 |
Fly.io provides excellent WebSocket support and global edge deployment.
|
| 217 |
|
|
@@ -306,7 +434,7 @@ Your app will be at: `https://mummy-card-game.fly.dev`
|
|
| 306 |
|
| 307 |
---
|
| 308 |
|
| 309 |
-
## Option
|
| 310 |
|
| 311 |
For full control, deploy to a VPS.
|
| 312 |
|
|
@@ -381,7 +509,7 @@ sudo certbot --nginx -d yourdomain.com
|
|
| 381 |
|
| 382 |
---
|
| 383 |
|
| 384 |
-
## Option
|
| 385 |
|
| 386 |
Play with friends on the same WiFi network.
|
| 387 |
|
|
|
|
| 7 |
## Table of Contents
|
| 8 |
1. [Quick Deploy with Render (Recommended)](#option-1-render-recommended---free)
|
| 9 |
2. [Deploy with Railway](#option-2-railway)
|
| 10 |
+
3. [Deploy with Hugging Face Spaces](#option-3-hugging-face-spaces)
|
| 11 |
+
4. [Deploy with Fly.io](#option-4-flyio)
|
| 12 |
+
5. [Deploy with VPS (DigitalOcean/AWS)](#option-5-vps-digitalocean-aws-etc)
|
| 13 |
+
6. [Local Network (LAN Party)](#option-6-local-network-lan-party)
|
| 14 |
|
| 15 |
---
|
| 16 |
|
|
|
|
| 212 |
|
| 213 |
---
|
| 214 |
|
| 215 |
+
## Option 3: Hugging Face Spaces
|
| 216 |
+
|
| 217 |
+
Hugging Face Spaces offers free hosting with Docker support and WebSockets.
|
| 218 |
+
|
| 219 |
+
### Step 1: Create Hugging Face Account
|
| 220 |
+
1. Go to [huggingface.co](https://huggingface.co)
|
| 221 |
+
2. Sign up for free
|
| 222 |
+
|
| 223 |
+
### Step 2: Create a New Space
|
| 224 |
+
1. Click your profile → **"New Space"**
|
| 225 |
+
2. Configure:
|
| 226 |
+
- **Space name**: `mummy-card-game`
|
| 227 |
+
- **License**: Choose one (e.g., MIT)
|
| 228 |
+
- **SDK**: Select **"Docker"**
|
| 229 |
+
- **Hardware**: CPU basic (free)
|
| 230 |
+
3. Click **"Create Space"**
|
| 231 |
+
|
| 232 |
+
### Step 3: Create Dockerfile
|
| 233 |
+
|
| 234 |
+
Create a `Dockerfile` in the `Web` folder:
|
| 235 |
+
|
| 236 |
+
```dockerfile
|
| 237 |
+
FROM node:18-alpine
|
| 238 |
+
|
| 239 |
+
# Create app user (required by HF Spaces)
|
| 240 |
+
RUN addgroup -g 1000 appgroup && adduser -u 1000 -G appgroup -D appuser
|
| 241 |
+
|
| 242 |
+
WORKDIR /app
|
| 243 |
+
|
| 244 |
+
# Copy package files
|
| 245 |
+
COPY client/package*.json ./client/
|
| 246 |
+
COPY server/package*.json ./server/
|
| 247 |
+
|
| 248 |
+
# Install dependencies
|
| 249 |
+
RUN cd client && npm install
|
| 250 |
+
RUN cd server && npm install
|
| 251 |
+
|
| 252 |
+
# Copy source code
|
| 253 |
+
COPY . .
|
| 254 |
+
|
| 255 |
+
# Build client and server
|
| 256 |
+
RUN cd client && npm run build
|
| 257 |
+
RUN cd server && npm run build
|
| 258 |
+
|
| 259 |
+
# Change ownership
|
| 260 |
+
RUN chown -R appuser:appgroup /app
|
| 261 |
+
|
| 262 |
+
# Switch to non-root user
|
| 263 |
+
USER appuser
|
| 264 |
+
|
| 265 |
+
# Hugging Face Spaces uses port 7860
|
| 266 |
+
ENV PORT=7860
|
| 267 |
+
EXPOSE 7860
|
| 268 |
+
|
| 269 |
+
# Start server
|
| 270 |
+
CMD ["node", "server/dist/index.js"]
|
| 271 |
+
```
|
| 272 |
+
|
| 273 |
+
### Step 4: Update Server Port (Optional)
|
| 274 |
+
|
| 275 |
+
The server already uses `process.env.PORT`, so it will automatically use port 7860 on HF Spaces.
|
| 276 |
+
|
| 277 |
+
### Step 5: Push to Hugging Face
|
| 278 |
+
|
| 279 |
+
**Option A: Using Git (Recommended)**
|
| 280 |
+
|
| 281 |
+
```bash
|
| 282 |
+
# Clone your HF Space
|
| 283 |
+
git clone https://huggingface.co/spaces/YOUR_USERNAME/mummy-card-game
|
| 284 |
+
cd mummy-card-game
|
| 285 |
+
|
| 286 |
+
# Copy your project files
|
| 287 |
+
# (copy all files from Web folder here)
|
| 288 |
+
|
| 289 |
+
# Push to HF
|
| 290 |
+
git add .
|
| 291 |
+
git commit -m "Initial deployment"
|
| 292 |
+
git push
|
| 293 |
+
```
|
| 294 |
+
|
| 295 |
+
**Option B: Upload via Web Interface**
|
| 296 |
+
1. Go to your Space → **Files** tab
|
| 297 |
+
2. Click **"Add file"** → **"Upload files"**
|
| 298 |
+
3. Upload all project files maintaining folder structure:
|
| 299 |
+
- `Dockerfile`
|
| 300 |
+
- `client/` folder
|
| 301 |
+
- `server/` folder
|
| 302 |
+
- `shared/` folder
|
| 303 |
+
- `Assests/` folder
|
| 304 |
+
|
| 305 |
+
### Step 6: Wait for Build
|
| 306 |
+
- Hugging Face will automatically build and deploy
|
| 307 |
+
- Build takes 3-5 minutes
|
| 308 |
+
- Your app will be at: `https://YOUR_USERNAME-mummy-card-game.hf.space`
|
| 309 |
+
|
| 310 |
+
### Step 7: Check Logs (if issues)
|
| 311 |
+
1. Go to your Space
|
| 312 |
+
2. Click the **"Logs"** button (three dots menu)
|
| 313 |
+
3. Check for any build or runtime errors
|
| 314 |
+
|
| 315 |
+
### Hugging Face Tips
|
| 316 |
+
|
| 317 |
+
**Persistent Storage**: Free tier doesn't have persistent storage, meaning game rooms are lost on restart. This is fine for a card game.
|
| 318 |
+
|
| 319 |
+
**Sleep Mode**: Free Spaces sleep after inactivity. First access after sleep takes ~30 seconds.
|
| 320 |
+
|
| 321 |
+
**Custom Domain**: You can add a custom domain in Space settings.
|
| 322 |
+
|
| 323 |
+
### Alternative: README.md Configuration
|
| 324 |
+
|
| 325 |
+
Instead of uploading files directly, you can create a `README.md` with YAML frontmatter:
|
| 326 |
+
|
| 327 |
+
```yaml
|
| 328 |
+
---
|
| 329 |
+
title: Mummy Card Game
|
| 330 |
+
emoji: 🎴
|
| 331 |
+
colorFrom: yellow
|
| 332 |
+
colorTo: red
|
| 333 |
+
sdk: docker
|
| 334 |
+
app_port: 7860
|
| 335 |
+
---
|
| 336 |
+
```
|
| 337 |
+
|
| 338 |
+
Place this at the root of your Space repository.
|
| 339 |
+
|
| 340 |
+
---
|
| 341 |
+
|
| 342 |
+
## Option 4: Fly.io
|
| 343 |
|
| 344 |
Fly.io provides excellent WebSocket support and global edge deployment.
|
| 345 |
|
|
|
|
| 434 |
|
| 435 |
---
|
| 436 |
|
| 437 |
+
## Option 5: VPS (DigitalOcean, AWS, etc.)
|
| 438 |
|
| 439 |
For full control, deploy to a VPS.
|
| 440 |
|
|
|
|
| 509 |
|
| 510 |
---
|
| 511 |
|
| 512 |
+
## Option 6: Local Network (LAN Party)
|
| 513 |
|
| 514 |
Play with friends on the same WiFi network.
|
| 515 |
|
readme.md
CHANGED
|
@@ -1 +1,26 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Khofo Card Game
|
| 3 |
+
emoji: 🎴
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: red
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Khofo - Egyptian Mummy Card Game
|
| 11 |
+
|
| 12 |
+
A multiplayer Egyptian-themed card game with real-time gameplay.
|
| 13 |
+
|
| 14 |
+
## How to Play
|
| 15 |
+
|
| 16 |
+
1. Open the game link
|
| 17 |
+
2. Enter your name
|
| 18 |
+
3. Create or join a room
|
| 19 |
+
4. Play with friends!
|
| 20 |
+
|
| 21 |
+
## Features
|
| 22 |
+
|
| 23 |
+
- Real-time multiplayer using WebSockets
|
| 24 |
+
- Egyptian-themed cards with unique abilities
|
| 25 |
+
- King Ra Says NO! reaction system
|
| 26 |
+
- Mummy elimination mechanics
|