LokeshEka commited on
Commit
74a879e
·
verified ·
1 Parent(s): a3f7dbd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -24
Dockerfile CHANGED
@@ -1,34 +1,22 @@
1
- # Use a specific version for reproducibility
2
- FROM node:20-slim
3
 
4
- # Create a non-root user 'appuser' and its home directory
5
- RUN useradd -m -s /bin/bash appuser
6
 
7
- # Switch to the non-root user *early*.
8
- # All subsequent commands will be run as 'appuser'.
9
- USER appuser
 
 
 
 
 
10
 
11
- # Set the user's home directory as a base
12
- ENV HOME=/home/appuser
13
- # Set the application directory inside the user's home
14
- ENV APP_HOME=${HOME}/app
15
- # Set the WORKDIR. Since we are 'appuser', this directory will be created and owned by 'appuser'.
16
- WORKDIR ${APP_HOME}
17
-
18
- # Create the '/tmp/images' directory owned by 'appuser' with full permissions
19
- RUN mkdir -p /tmp/images && chmod 777 /tmp/images
20
-
21
- # Copy package files. They will be owned by 'appuser' because of the USER command above.
22
  COPY package*.json ./
23
-
24
- # Run npm install as 'appuser'. It has permission to write to its own WORKDIR.
25
  RUN npm install
26
 
27
- # Copy the rest of the application code. It will also be owned by 'appuser'.
28
  COPY . .
29
 
30
- # Expose the port
31
  EXPOSE 7860
32
 
33
- # Run the server. The process starts as 'appuser' and has full control over the APP_HOME directory.
34
- CMD ["node", "server.js"]
 
1
+ FROM node:20
 
2
 
3
+ WORKDIR /app
 
4
 
5
+ # Install system dependencies if needed (e.g., for canvas)
6
+ RUN apt-get update && apt-get install -y \
7
+ build-essential \
8
+ libcairo2-dev \
9
+ libpango1.0-dev \
10
+ libjpeg-dev \
11
+ libgif-dev \
12
+ librsvg2-dev
13
 
 
 
 
 
 
 
 
 
 
 
 
14
  COPY package*.json ./
 
 
15
  RUN npm install
16
 
 
17
  COPY . .
18
 
19
+ ENV PORT=7860
20
  EXPOSE 7860
21
 
22
+ CMD ["node", "server.js"]