|
|
|
|
|
|
|
|
FROM node:20-alpine AS frontend-builder
|
|
|
WORKDIR /app
|
|
|
COPY frontend/package.json frontend/package-lock.json* ./
|
|
|
RUN npm ci --no-audit --no-fund || npm install --no-audit --no-fund
|
|
|
COPY frontend/ ./
|
|
|
RUN npm run build
|
|
|
|
|
|
FROM python:3.11-slim AS backend
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
|
PYTHONUNBUFFERED=1
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
libgomp1 \
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
COPY requirements.txt ./
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
|
|
COPY . /app
|
|
|
|
|
|
|
|
|
RUN mkdir -p /app/frontend/dist
|
|
|
COPY --from=frontend-builder /app/dist /app/frontend/dist
|
|
|
|
|
|
EXPOSE 7860
|
|
|
|
|
|
|
|
|
CMD ["sh", "-c", "uvicorn api_server:app --host 0.0.0.0 --port ${PORT:-7860}"]
|
|
|
|
|
|
|
|
|
|