Download Dockerfile from ketannnn/coderound: direct link, hf CLI and curl.
- Browser
- Download file 2.34 kB
-
https://huggingface.co/spaces/ketannnn/coderound/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/ketannnn/coderound/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/ketannnn/coderound/resolve/main/Dockerfile
2.34 kB
| # ==================================================== | |
| # Stage 1: Build Next.js frontend (standalone output) | |
| # ==================================================== | |
| FROM node:20-alpine AS frontend-build | |
| WORKDIR /build/frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm ci --frozen-lockfile | |
| COPY frontend/ . | |
| ENV NEXT_PUBLIC_API_URL="" | |
| RUN npm run build | |
| # ==================================================== | |
| # Stage 2: Final image — Python + Node + Nginx + Supervisor | |
| # ==================================================== | |
| FROM python:3.11-slim | |
| # System dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| nginx supervisor nodejs npm curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create non-root user (HF Spaces runs as UID 1000) | |
| RUN useradd -m -u 1000 appuser | |
| WORKDIR /app | |
| # Install Python dependencies | |
| COPY backend/requirements.txt ./requirements.txt | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Set Universal Cache Directory so models are truly "baked in" and never downloaded at runtime | |
| ENV HF_HOME="/app/models" | |
| ENV SENTENCE_TRANSFORMERS_HOME="/app/models" | |
| # Pre-download BOTH the embedding model AND the heavy reranker model so they start instantly | |
| RUN python -c "\ | |
| from sentence_transformers import SentenceTransformer; \ | |
| from FlagEmbedding import FlagReranker; \ | |
| SentenceTransformer('BAAI/bge-small-en-v1.5'); \ | |
| FlagReranker('BAAI/bge-reranker-v2-m3', use_fp16=False); \ | |
| print('All AI Models baked into Docker Image successfully!')" | |
| # Copy backend source | |
| COPY backend/ /app/backend/ | |
| # Copy Next.js standalone build | |
| COPY --from=frontend-build /build/frontend/.next/standalone /app/frontend/ | |
| COPY --from=frontend-build /build/frontend/.next/static /app/frontend/.next/static/ | |
| COPY --from=frontend-build /build/frontend/public /app/frontend/public/ | |
| # Copy config files | |
| COPY nginx.conf /app/nginx.conf | |
| COPY supervisord.conf /app/supervisord.conf | |
| # Fix nginx tmp dirs and permissions | |
| RUN mkdir -p /tmp/nginx_client /tmp/nginx_proxy /tmp/nginx_fastcgi /tmp/nginx_uwsgi /tmp/nginx_scgi \ | |
| && chown -R appuser:appuser /app /tmp \ | |
| && chown -R appuser:appuser /var/lib/nginx /var/log/nginx 2>/dev/null || true \ | |
| && chmod -R 755 /var/lib/nginx 2>/dev/null || true | |
| # HF Spaces requires port 7860 | |
| EXPOSE 7860 | |
| USER 1000 | |
| CMD ["/usr/bin/supervisord", "-c", "/app/supervisord.conf"] | |