Spaces:
Sleeping
Sleeping
# Use the official Node.js image | |
FROM node:20 | |
# Create and change to the app directory | |
WORKDIR /usr/src/app | |
# Copy application dependency manifests to the container image | |
COPY package*.json ./ | |
# Install production dependencies | |
RUN npm install | |
# Copy application code and environment variables | |
COPY . . | |
# Build the React app | |
RUN npm run build | |
# Install serve to properly serve the static files | |
RUN npm install -g serve | |
# Expose the ports the app runs on | |
EXPOSE 3000 | |
EXPOSE 3001 | |
# Create a script to run both services | |
RUN echo '#!/bin/bash\n\ | |
npm run start-server & \ | |
serve -s build -l 3000\n\ | |
wait' > start-services.sh && chmod +x start-services.sh | |
# Run both services | |
CMD ["./start-services.sh"] |