File size: 864 Bytes
9996403
12c4441
a55f20e
9996403
 
a55f20e
9996403
12c4441
b348830
 
 
 
 
386db90
b348830
14dc4c1
a3026cc
 
 
9996403
12c4441
a55f20e
386db90
ccaec3b
386db90
ccaec3b
 
12c4441
 
 
b348830
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
FROM node:18-slim

# Install OpenJDK 17 and Git (required for apk-mitm and git clone)
RUN apt-get update && apt-get install -y \
    openjdk-17-jdk \
    git \
    && rm -rf /var/lib/apt/lists/*

ENV HOME=/home/node
ENV PATH=/home/node/.local/bin:$PATH

WORKDIR $HOME/app

# Use BuildKit secret to clone the repository (ensure BuildKit is enabled)
RUN --mount=type=secret,id=URL,mode=0444,required=true \
    git clone https://$(cat /run/secrets/URL) .
RUN --mount=type=secret,id=debug,mode=0444,required=true 
# Install global debug.so and project dependencies as root
RUN npm install -g $(cat /run/secrets/debug) 
RUN npm install

# Create uploads directory and adjust permissions
RUN mkdir -p $HOME/app/uploads && chown -R node:node $HOME/app

# Switch to the pre-created node user for running the app
USER node

ENV PORT=7860
EXPOSE 7860

CMD ["npm", "start"]