File size: 983 Bytes
908f463
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM node:latest

USER root
# Create app directory and set permissions ๐Ÿ™‚๐Ÿ˜ฎโ€๐Ÿ’จ
RUN mkdir -p /app && chown -R node:node /app

# Install required packages
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    ffmpeg \
    webp \
    git \
    dnsutils \
    ca-certificates && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /app

# Clone the private GitHub repository using the GitHub token from Docker BuildKit secrets
RUN --mount=type=secret,id=GITHUB_REPO,required=true \
    --mount=type=secret,id=GITHUB_TOKEN,required=true \
    git clone https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/$(cat /run/secrets/GITHUB_REPO).git .

# Switch to the node user

COPY --chown=node:node . .

RUN mkdir -p /app/lib/database && chown -R node:node /app/lib

# Set permissions for the /app directory to allow writing
RUN chmod -R 777 /app

RUN npm install
EXPOSE 7860
ENV NODE_ENV=production
CMD ["npm", "start"]