FROM node:20 # Install unzip utility RUN apt-get update && apt-get install -y unzip WORKDIR /app # Copy the ZIP file from your Space COPY Section_one.zip . # Unzip the project RUN unzip -o Section_one.zip && rm Section_one.zip # --- STEP 1: FRONTEND BUILD --- # This ensures all "localhost" calls are replaced by the build process RUN cd Section_one/frontend && npm install --legacy-peer-deps && npm run build # --- STEP 2: BACKEND SETUP --- RUN cd Section_two/backend && npm install # --- STEP 3: LINKING FRONTEND TO BACKEND --- # Create static folder and move the fresh React build there RUN mkdir -p Section_two/backend/static RUN cp -r Section_one/frontend/build/* Section_two/backend/static/ # --- STEP 4: CONFIGURATION --- ENV PORT=7860 ENV NODE_ENV=production EXPOSE 7860 # Start the server using the correct port CMD ["sh", "-c", "PORT=7860 node Section_two/backend/index.js"]