Spaces:
Running
Running
File size: 1,242 Bytes
c719f43 ad08f08 c719f43 ad08f08 c719f43 ad08f08 c719f43 ad08f08 c719f43 ad08f08 c719f43 ad08f08 c719f43 ad08f08 c719f43 ad08f08 c719f43 ad08f08 c719f43 |
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# 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"] |