Spaces:
Running
Running
| # Dockerfile for Palisade Security Leaderboard on HuggingFace Spaces | |
| FROM node:20-bookworm-slim | |
| RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* | |
| # Clone the leaderboard repository from GitHub | |
| # HF Spaces mounts secrets at /run/secrets/<SECRET_NAME> during build | |
| RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444 \ | |
| if [ -f /run/secrets/GITHUB_TOKEN ]; then \ | |
| GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN) && \ | |
| git clone https://${GITHUB_TOKEN}@github.com/highflame-ai/palisade-leaderboard.git /palisade-leaderboard; \ | |
| else \ | |
| git clone https://github.com/highflame-ai/palisade-leaderboard.git /palisade-leaderboard; \ | |
| fi | |
| # Use the existing 'node' user (UID 1000) that comes with the node image | |
| RUN chown -R node:node /palisade-leaderboard | |
| USER node | |
| WORKDIR /palisade-leaderboard/frontend | |
| # Install dependencies and build | |
| RUN npm ci | |
| RUN npm run build | |
| # Copy static files to standalone directory (required for standalone mode) | |
| RUN cp -r .next/static .next/standalone/.next/ && \ | |
| (cp -r public .next/standalone/ 2>/dev/null || mkdir -p .next/standalone/public) | |
| ENV NODE_ENV=production | |
| ENV NEXT_TELEMETRY_DISABLED=1 | |
| ENV PORT=7860 | |
| ENV HOSTNAME="0.0.0.0" | |
| EXPOSE 7860 | |
| # Use standalone server for better performance | |
| CMD ["node", ".next/standalone/server.js"] | |