open-llm-leaderboard/open_llm_leaderboard
14k
1# Build frontend2FROM node:18 as frontend-build3WORKDIR /app4COPY frontend/package*.json ./5RUN npm install6COPY frontend/ ./7 8RUN npm run build9 10# Build backend11FROM python:3.12-slim12WORKDIR /app13 14# Create non-root user15RUN useradd -m -u 1000 user16 17# Install poetry18RUN pip install poetry19 20# Create and configure cache directory21RUN mkdir -p /app/.cache && \22 chown -R user:user /app23 24# Copy and install backend dependencies25COPY backend/pyproject.toml backend/poetry.lock* ./26RUN poetry config virtualenvs.create false \27 && poetry install --no-interaction --no-ansi --no-root --only main28 29# Copy backend code30COPY backend/ .31 32# Install Node.js and npm33RUN apt-get update && apt-get install -y \34 curl \35 netcat-openbsd \36 && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \37 && apt-get install -y nodejs \38 && rm -rf /var/lib/apt/lists/*39 40# Copy frontend server and build41COPY --from=frontend-build /app/build ./frontend/build42COPY --from=frontend-build /app/package*.json ./frontend/43COPY --from=frontend-build /app/server.js ./frontend/44 45# Install frontend production dependencies46WORKDIR /app/frontend47RUN npm install --production48WORKDIR /app49 50# Environment variables51ENV HF_HOME=/app/.cache \52 HF_DATASETS_CACHE=/app/.cache \53 INTERNAL_API_PORT=7861 \54 PORT=7860 \55 NODE_ENV=production56 57# Note: HF_TOKEN should be provided at runtime, not build time58USER user59EXPOSE 786060 61# Start both servers with wait-for62CMD ["sh", "-c", "export HF_HOME=/app/.cache && export HF_DATASETS_CACHE=/app/.cache/datasets && uvicorn app.asgi:app --host 0.0.0.0 --port 7861 & while ! nc -z localhost 7861; do sleep 1; done && cd frontend && npm run serve"]