vikarshana commited on
Commit
2c5de4f
·
verified ·
1 Parent(s): b0052ab

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -0
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:20
2
+
3
+ USER root
4
+ # Create app directory and set permissions
5
+ RUN mkdir -p /app && chown -R node:node /app
6
+
7
+ # Install necessary dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ git \
10
+ ffmpeg \
11
+ imagemagick \
12
+ webp \
13
+ && apt-get clean \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Set the working directory
17
+ WORKDIR /app
18
+
19
+ # Clone the private GitHub repository using the GitHub token from Docker BuildKit secrets
20
+ RUN --mount=type=secret,id=GITHUB_REPO,required=true \
21
+ --mount=type=secret,id=GITHUB_TOKEN,required=true \
22
+ git clone https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/$(cat /run/secrets/GITHUB_REPO).git .
23
+
24
+ # Switch to the node user
25
+ COPY --chown=node:node . .
26
+
27
+ RUN mkdir -p /app/lib/database && chown -R node:node /app/lib
28
+
29
+ # Update npm to the latest version
30
+ RUN npm install -g npm@latest
31
+ RUN npm install
32
+ EXPOSE 7860
33
+ ENV NODE_ENV=production
34
+ CMD ["sh", "start.sh"]