# Multi-stage Dockerfile for BioNexus Hub # Build the client FROM node:18-alpine AS client-builder WORKDIR /app # Copy client package files COPY client/package*.json ./ # Install client dependencies RUN npm install # Copy client source COPY client/ ./ # Build client RUN npm run build # Production image FROM node:18-alpine # Create app directory WORKDIR /app # Copy package files for server COPY server/package*.json ./ # Install server dependencies RUN npm install --only=production # Copy server source COPY server/ ./ # Copy client build to public directory RUN mkdir -p public COPY --from=client-builder /app/dist public # Set environment variables for Hugging Face Spaces ENV HF_SPACES=true ENV PORT=8501 ENV NODE_ENV=production # Expose port 8501 for Hugging Face Spaces EXPOSE 8501 # Start the Node.js server CMD ["node", "index.js"]