| |
| FROM node:20-slim AS frontend |
| WORKDIR /fe |
| COPY frontend/package.json frontend/package-lock.json* ./ |
| RUN npm install |
| COPY frontend/ ./ |
| RUN npm run build |
|
|
| |
| FROM python:3.11-slim |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| libglib2.0-0 libgl1 && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN useradd -m -u 1000 user |
| ENV HOME=/home/user \ |
| PATH=/home/user/.local/bin:$PATH |
|
|
| WORKDIR $HOME/app |
|
|
| COPY requirements.txt . |
| RUN pip install --no-cache-dir -r requirements.txt |
|
|
| COPY . . |
|
|
| |
| COPY --from=frontend /fe/dist ./frontend/dist |
|
|
| |
| RUN mkdir -p data/images && chown -R user:user $HOME/app |
|
|
| |
| USER user |
|
|
| EXPOSE 7860 |
| CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "7860"] |
|
|