File size: 908 Bytes
5f3b513
 
 
 
 
 
 
 
 
 
 
532e19f
 
 
 
5f3b513
 
532e19f
5f3b513
 
 
 
 
532e19f
5f3b513
 
532e19f
5f3b513
532e19f
5f3b513
 
 
 
532e19f
5f3b513
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
FROM node:22-bookworm-slim AS frontend-build

RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/*

WORKDIR /frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ ./
RUN npm run build

FROM python:3.11-slim AS app

WORKDIR /app

RUN apt-get update && \
    apt-get install -y --no-install-recommends git && \
    apt-get upgrade -y && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* && \
    useradd --create-home --uid 1000 appuser

COPY requirements-api.txt ./
RUN pip install --no-cache-dir -r requirements-api.txt

COPY --chown=appuser:appuser . ./
COPY --from=frontend-build --chown=appuser:appuser /frontend/dist ./frontend/dist

RUN mkdir -p /app/workspaces && chown -R appuser:appuser /app

ENV PYTHONUNBUFFERED=1
ENV PORT=7860
EXPOSE 7860
USER appuser

CMD ["sh", "-c", "uvicorn backend.app:app --host 0.0.0.0 --port ${PORT:-7860}"]