ndwdgda/replit2
0
1# Stage 1: Build React Frontend2FROM node:18-slim as build3WORKDIR /app4COPY frontend/package.json frontend/package-lock.json* ./5RUN npm install6 7# Force rebuild of frontend8ARG CACHE_BUST=v149COPY frontend/ .10RUN npm run build11 12# Stage 2: Python Backend13FROM python:3.9-slim14 15# Set up a new user named "user" with user ID 100016RUN useradd -m -u 1000 user17 18# Set up persistent data directory (as root)19ENV DATA_DIR=/data20RUN mkdir -p $DATA_DIR && chown -R user:user $DATA_DIR && chmod 777 $DATA_DIR21 22# SwitchRUN echo "Cache Buster: v19" user23USER user24 25# Set home to the user's home directory26ENV HOME=/home/user \27 PATH=/home/user/.local/bin:$PATH28 29# Set the working directory to the user's home directory30WORKDIR $HOME/app31 32# Copy the current directory contents into the container at $HOME/app setting the owner to the user33COPY --chown=user . $HOME/app34 35# Force frontend rebuild36ARG CACHE_BUST=v237COPY --from=build --chown=user /app/dist $HOME/app/frontend/dist38 39# Install requirements40RUN pip install --no-cache-dir --upgrade -r requirements.txt41 42# Command to run the application43CMD sh -c "echo 'Starting HHeuristics v2.1...' && uvicorn app:app --host 0.0.0.0 --port 7860 --workers 1"44 