Spaces:
Running
Running
| # Hugging Face Spaces (Docker SDK): React SPA + FastAPI + SQLite FTS procurement catalogue | |
| FROM node:20-bookworm-slim AS frontend | |
| WORKDIR /app | |
| COPY package.json package-lock.json* ./ | |
| RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi | |
| COPY . . | |
| RUN npm run build | |
| # Official tag is python:<version>-slim-<distro>, not ...-distro-slim | |
| FROM python:3.11-slim-bookworm AS runtime | |
| WORKDIR /app | |
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends nginx \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY server ./server | |
| COPY data/unspsc-english.xlsx ./data/unspsc-english.xlsx | |
| ENV UNSPSC_XLSX_PATH=/app/data/unspsc-english.xlsx | |
| ENV UNSPSC_DB_PATH=/app/data/unspsc.db | |
| RUN python -m server.build_db | |
| COPY --from=frontend /app/dist /usr/share/nginx/html | |
| COPY nginx.conf /etc/nginx/conf.d/default.conf | |
| COPY docker/start.sh /start.sh | |
| RUN chmod +x /start.sh | |
| EXPOSE 7860 | |
| CMD ["/start.sh"] | |