File size: 1,539 Bytes
3adbdc8
 
 
17b24dc
 
3adbdc8
17a0f2d
 
 
 
 
 
3adbdc8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7fe40a3
 
 
 
 
3adbdc8
17b24dc
 
3adbdc8
17b24dc
 
3adbdc8
 
 
 
 
e0b91a3
 
 
3adbdc8
 
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
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"]