Spaces:
Sleeping
Sleeping
File size: 893 Bytes
8286452 c8513f1 8286452 c8513f1 8286452 876ed24 c8513f1 8286452 27f5065 c8513f1 8286452 c8513f1 8286452 c8513f1 a25f84b c8513f1 8286452 a25f84b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 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"] |