FROM node:18.8 as build-deps

WORKDIR /app
COPY client/package.json ./
COPY client/package-lock.json ./
COPY client/rollup.config.js ./
COPY client/src ./src/
RUN npm run build


FROM python:latest
ENV TZ Europe/Zurich

RUN apt-get update && apt-get install -y postgresql

RUN mkdir -p /app/news_check

COPY requirements.txt /app/requirements.txt
RUN python3 -m pip install -r /app/requirements.txt
COPY --from=build-deps /app/public /app/news_check/public

COPY app /app/news_check
WORKDIR /app/news_check

CMD gunicorn app:app -w 1 --threads 2 -b 0.0.0.0:80