changwenhan commited on
Commit
6e70688
·
verified ·
1 Parent(s): a8f1fe8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -1
Dockerfile CHANGED
@@ -19,5 +19,24 @@ EXPOSE 7860
19
  # Define environment variable
20
  ENV PORT=7860
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  # Run the application
23
- CMD ["npm", "start"]
 
19
  # Define environment variable
20
  ENV PORT=7860
21
 
22
+ # Create an entrypoint script to set sysctl and ulimit settings
23
+ RUN echo "#!/bin/sh" > /entrypoint.sh && \
24
+ echo "sysctl -w net.ipv4.ip_local_port_range='1024 65535'" >> /entrypoint.sh && \
25
+ echo "sysctl -w net.ipv4.tcp_mem='131072 262144 524288'" >> /entrypoint.sh && \
26
+ echo "sysctl -w net.ipv4.tcp_rmem='8760 256960 4088000'" >> /entrypoint.sh && \
27
+ echo "sysctl -w net.ipv4.tcp_wmem='8760 256960 4088000'" >> /entrypoint.sh && \
28
+ echo "sysctl -w net.core.rmem_max=16384" >> /entrypoint.sh && \
29
+ echo "sysctl -w net.core.wmem_max=16384" >> /entrypoint.sh && \
30
+ echo "sysctl -w net.core.somaxconn=2048" >> /entrypoint.sh && \
31
+ echo "sysctl -w net.ipv4.tcp_max_syn_backlog=2048" >> /entrypoint.sh && \
32
+ echo "sysctl -w net.core.netdev_max_backlog=2048" >> /entrypoint.sh && \
33
+ echo "sysctl -w net.ipv4.tcp_tw_reuse=1" >> /entrypoint.sh && \
34
+ echo "ulimit -n 2000500" >> /entrypoint.sh && \
35
+ echo "exec \"\$@\"" >> /entrypoint.sh && \
36
+ chmod +x /entrypoint.sh
37
+
38
+ # Use the entrypoint script
39
+ ENTRYPOINT ["/entrypoint.sh"]
40
+
41
  # Run the application
42
+ CMD ["npm", "start"]