no1b4me commited on
Commit
ab989b7
·
verified ·
1 Parent(s): 16f6d2c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -3
Dockerfile CHANGED
@@ -5,16 +5,22 @@ FROM node:16
5
  WORKDIR /usr/src/app
6
 
7
  # Copy package.json and package-lock.json
8
- COPY package.json ./
9
 
10
  # Install dependencies
11
  RUN npm install
12
 
13
- # Copy application files
14
  COPY . .
15
 
 
 
 
 
 
16
  # Create logs directory and set appropriate permissions
17
- RUN mkdir logs && chmod -R 777 logs
 
18
 
19
  # Install Hugging Face Transformers and required libraries
20
  RUN npm install @huggingface/inference
@@ -25,5 +31,8 @@ RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
25
  # Expose the application port
26
  EXPOSE 3001
27
 
 
 
 
28
  # Define the default command to start the app
29
  CMD ["npm", "start"]
 
5
  WORKDIR /usr/src/app
6
 
7
  # Copy package.json and package-lock.json
8
+ COPY package.json package-lock.json ./
9
 
10
  # Install dependencies
11
  RUN npm install
12
 
13
+ # Copy application files, including models, into the container
14
  COPY . .
15
 
16
+ # Set appropriate permissions for the copied files
17
+ # This ensures that files in the container are accessible and writable
18
+ RUN chmod -R 755 /usr/src/app && \
19
+ chown -R node:node /usr/src/app
20
+
21
  # Create logs directory and set appropriate permissions
22
+ RUN mkdir /usr/src/app/logs && \
23
+ chmod -R 777 /usr/src/app/logs
24
 
25
  # Install Hugging Face Transformers and required libraries
26
  RUN npm install @huggingface/inference
 
31
  # Expose the application port
32
  EXPOSE 3001
33
 
34
+ # Use a non-root user to run the application
35
+ USER node
36
+
37
  # Define the default command to start the app
38
  CMD ["npm", "start"]