|
|
| FROM node:20 AS ui-builder
|
| WORKDIR /app
|
| COPY package.json package-lock.json* ./
|
| RUN npm install
|
| COPY . .
|
| RUN npm run build
|
|
|
|
|
| FROM python:3.10-slim AS ai-builder
|
| WORKDIR /app
|
| COPY requirements.txt .
|
| RUN pip install --no-cache-dir -r requirements.txt
|
| COPY app.py dataset.json ./
|
|
|
|
|
| FROM nginx:latest
|
|
|
|
|
| RUN apt-get update && \
|
| apt-get install -y python3 python3-pip python3-venv build-essential pkg-config && \
|
| rm -rf /var/lib/apt/lists/*
|
|
|
|
|
| COPY --from=ui-builder /app/dist /usr/share/nginx/html
|
|
|
|
|
| COPY --from=ai-builder /app/app.py /app/dataset.json /app/
|
| COPY requirements.txt /app/
|
|
|
|
|
| COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
|
| RUN python3 -m venv /venv
|
| ENV PATH="/venv/bin:$PATH"
|
| RUN pip install --no-cache-dir cython
|
| RUN pip install --no-cache-dir -r /app/requirements.txt
|
|
|
|
|
| EXPOSE 7860
|
|
|
|
|
| RUN mkdir -p /var/cache/nginx && chmod 777 /var/cache/nginx
|
|
|
|
|
| CMD python /app/app.py & nginx -g 'daemon off;'
|
|
|