OlivierDehaene commited on
Commit
93ed8a7
1 Parent(s): c5a5fad

update user

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -4
Dockerfile CHANGED
@@ -37,7 +37,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
37
  rm -rf /var/lib/apt/lists/*
38
 
39
  RUN mkdir -p /data/db
40
- RUN chmod 777 -R /data
41
 
42
  RUN curl -fsSL https://deb.nodesource.com/setup_19.x | /bin/bash -
43
 
@@ -45,16 +45,25 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
45
  nodejs && \
46
  rm -rf /var/lib/apt/lists/*
47
 
48
- RUN npm install -g pm2
49
  RUN mkdir /app
50
- RUN chmod 777 /app
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  COPY --from=chatui-builder --chown=1000 /app/chat-ui/node_modules /app/node_modules
53
  COPY --from=chatui-builder --chown=1000 /app/chat-ui/package.json /app/package.json
54
  COPY --from=chatui-builder --chown=1000 /app/chat-ui/build /app/build
55
 
56
  COPY entrypoint.sh entrypoint.sh
57
- RUN chmod +x entrypoint.sh
58
 
59
  ENTRYPOINT ["/bin/bash"]
60
  CMD ["entrypoint.sh"]
 
37
  rm -rf /var/lib/apt/lists/*
38
 
39
  RUN mkdir -p /data/db
40
+ RUN chown -R 1000:1000 /data/db
41
 
42
  RUN curl -fsSL https://deb.nodesource.com/setup_19.x | /bin/bash -
43
 
 
45
  nodejs && \
46
  rm -rf /var/lib/apt/lists/*
47
 
 
48
  RUN mkdir /app
49
+ RUN chown -R 1000:1000 /app
50
+
51
+ RUN useradd -m -u 1000 user
52
+
53
+ # Switch to the "user" user
54
+ USER user
55
+
56
+ ENV HOME=/home/user \
57
+ PATH=/home/user/.local/bin:$PATH
58
+
59
+ RUN npm config set prefix /home/user/.local
60
+ RUN npm install -g pm2
61
 
62
  COPY --from=chatui-builder --chown=1000 /app/chat-ui/node_modules /app/node_modules
63
  COPY --from=chatui-builder --chown=1000 /app/chat-ui/package.json /app/package.json
64
  COPY --from=chatui-builder --chown=1000 /app/chat-ui/build /app/build
65
 
66
  COPY entrypoint.sh entrypoint.sh
 
67
 
68
  ENTRYPOINT ["/bin/bash"]
69
  CMD ["entrypoint.sh"]