Spaces:
Sleeping
Sleeping
FROM python:3.10 | |
FROM continuumio/miniconda3 | |
RUN useradd user | |
USER user | |
COPY ./requirements.txt requirements.txt | |
ENV PYTHONDONTWRITEBYTECODE=1 | |
ENV PYTHONUNBUFFERED=1 | |
ENV DEBIAN_FRONTEND=noninteractive | |
ENV PATH /opt/conda/bin:$PATH | |
# Set working directory | |
WORKDIR /app | |
# Copy backend files | |
COPY . /app | |
USER root | |
RUN apt-get update && apt-get install -y build-essential git curl | |
# Create conda environment & install Python 3.10 | |
RUN conda create --name myenv python=3.10 -y | |
SHELL ["conda", "run", "-n", "myenv", "/bin/bash", "-c"] | |
RUN pip install --upgrade pip && pip install -r requirements.txt | |
# Clone React frontend from GitHub | |
RUN apt-get update && \ | |
apt-get install -y git curl && \ | |
git clone https://github.com/vijaysagi12/myinzackBot.git /frontend | |
COPY . . | |
# Install Node.js & npm (for React) | |
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ | |
apt-get install -y nodejs && \ | |
cd /frontend && npm install | |
RUN rm -f /frontend/node_modules/.cache/.eslintcache || true | |
RUN npm run build | |
# Expose Flask and React ports | |
EXPOSE 5000 3000 | |
# Start both Flask and React servers | |
CMD ["/bin/bash", "-c", "source activate myenv && \ | |
(cd /frontend && npm start &) && \ | |
python app.py"] | |