File size: 984 Bytes
a44477f
84983c9
3c11192
 
 
 
 
 
 
 
c57f14c
 
84983c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3c11192
84983c9
3c11192
84983c9
 
3c11192
 
 
84983c9
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
# 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.12-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"]