FROM node:18-alpine as builder
WORKDIR /src
COPY ./front/package.json front/package-lock.json .
RUN npm ci
COPY front .
RUN npm run build

FROM python:3-slim
WORKDIR /srv
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt
COPY ./back ./back
COPY --from=builder /src/dist ./front/dist
CMD uvicorn back.main:app --host 0.0.0.0 --port 80
