FROM bioconductor/bioconductor_docker:RELEASE_3_18 # Create a non-root user required by Hugging Face Spaces (UID 1000) # Use --non-unique in case UID 1000 already exists in the base image RUN useradd -m -u 1000 --non-unique user 2>/dev/null || true # Remove any pre-installed conflicting Node.js packages from the base image, # then install Node.js 20 from NodeSource RUN apt-get update \ && apt-get remove -y nodejs libnode-dev libnode72 2>/dev/null || true \ && apt-get autoremove -y \ && apt-get install -y curl \ && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ && apt-get install -y nodejs \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Install required R packages for peak picking RUN R -e 'BiocManager::install(c("MSnbase", "xcms", "optparse"), update = FALSE, ask = FALSE)' # Create application directory WORKDIR /app # Copy R script COPY lc_ms_peak_picker.R . # Copy and install backend COPY backend/package.json ./backend/ WORKDIR /app/backend RUN npm install COPY backend/ . # Reset to app root before copying frontend dist WORKDIR /app # Copy the pre-built frontend so it can be served COPY frontend/dist ./frontend/dist # Give ownership of the /app directory to UID 1000 RUN chown -R 1000:1000 /app # Switch to UID 1000 (works regardless of username) USER 1000 # Ensure Hugging Face runs it on port 7860 ENV PORT=7860 EXPOSE 7860 # npm start must run from the backend directory where package.json lives WORKDIR /app/backend # Start the server CMD ["npm", "start"]