Spaces:
Sleeping
Sleeping
| # 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 | |
| # Install nginx | |
| RUN apk add --no-cache nginx | |
| # 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/ ./ | |
| # Create directory for nginx and copy client build | |
| RUN mkdir -p /usr/share/nginx/html | |
| COPY --from=client-builder /app/dist /usr/share/nginx/html | |
| # Copy nginx configuration | |
| COPY client/nginx.conf /etc/nginx/http.d/default.conf | |
| # Copy startup script | |
| COPY startup.sh . | |
| # Make startup script executable | |
| RUN chmod +x startup.sh | |
| # Set environment variable for Hugging Face Spaces | |
| ENV HF_SPACES=true | |
| # Create nginx directories with proper permissions | |
| RUN mkdir -p /var/lib/nginx/tmp/client_body && \ | |
| chmod -R 755 /var/lib/nginx && \ | |
| chown -R nginx:nginx /var/lib/nginx | |
| # Expose ports | |
| EXPOSE 80 3001 | |
| # Start both nginx and node server | |
| CMD ["./startup.sh"] |