FROM python:3
RUN apt update
RUN apt-get install -y npm
COPY . .
WORKDIR /frontend
ENV NODE_OPTIONS --openssl-legacy-provider
RUN npm ci
RUN npm run build
WORKDIR /backend
RUN pip install --no-cache-dir -r requirements.txt
RUN mkdir -p src/static \
&& cd src/static \
&& cp -r /frontend/build/* . \
&& mv static/* . \
&& rmdir static
ENV FLASK_APP src/app
EXPOSE 5000
CMD flask run --host=0.0.0.0