Spaces:
Running
Running
File size: 1,743 Bytes
d01a676 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | # ============================================================
# 9Router - Hugging Face Spaces Dockerfile
# Port: 7860 (wajib untuk HF Spaces)
# ============================================================
FROM node:20-slim
# Install git dan dependencies sistem
RUN apt-get update && apt-get install -y \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Clone repo 9router
RUN git clone https://github.com/decolua/9router.git .
# Install dependencies npm
RUN npm install
# Build Next.js app
RUN npm run build
# Buat direktori untuk data storage
RUN mkdir -p /data /root/.9router
# ============================================================
# Environment Variables
# Set defaults yang aman - override via HF Spaces Secrets
# ============================================================
ENV PORT=7860
ENV HOSTNAME=0.0.0.0
ENV NODE_ENV=production
ENV DATA_DIR=/data
# BASE_URL akan di-set otomatis saat runtime jika ada SPACE_HOST
# Secrets ini HARUS di-set di HF Spaces Settings:
# INITIAL_PASSWORD - password login dashboard
# JWT_SECRET - secret untuk JWT token
# API_KEY_SECRET - secret untuk API keys
# MACHINE_ID_SALT - salt untuk machine ID
# Fallback defaults (GANTI via Secrets di HF Spaces!)
ENV INITIAL_PASSWORD=changeme123
ENV JWT_SECRET=please-change-this-jwt-secret-in-hf-spaces-settings
ENV API_KEY_SECRET=please-change-this-api-key-secret
ENV MACHINE_ID_SALT=please-change-this-salt
ENV REQUIRE_API_KEY=false
ENV AUTH_COOKIE_SECURE=true
ENV ENABLE_REQUEST_LOGS=false
# Expose port HF Spaces
EXPOSE 7860
# Script startup: set BASE_URL dari SPACE_HOST jika tersedia
COPY start-hf.sh /app/start-hf.sh
RUN chmod +x /app/start-hf.sh
CMD ["/app/start-hf.sh"] |