sanjay7178 commited on
Commit
843d79d
·
verified ·
1 Parent(s): 762fb69

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -10
Dockerfile CHANGED
@@ -18,13 +18,15 @@ RUN set -x \
18
  && npm cache clear --force \
19
  && chown -R rocketchat:rocketchat /app
20
 
21
- # Update sources to use the Debian archive
22
- RUN sed -i 's|http://deb.debian.org/debian|http://archive.debian.org/debian|' /etc/apt/sources.list && \
23
- sed -i '/security.debian.org/d' /etc/apt/sources.list && \
24
- apt-get update && \
25
- apt-get install -y socat && \
26
- rm -rf /var/lib/apt/lists/*
27
 
 
 
 
 
 
 
28
 
29
  USER rocketchat
30
 
@@ -41,9 +43,8 @@ ENV DEPLOY_METHOD=docker \
41
  ROOT_URL=http://localhost:3000 \
42
  Accounts_AvatarStorePath=/app/uploads
43
 
44
- # Expose port 7860 externally
45
  EXPOSE 7860
46
 
47
- # Run socat to forward port 7860 to 3000 and start Rocket.Chat
48
- CMD socat TCP-LISTEN:7860,reuseaddr,fork TCP:localhost:3000 & \
49
- node main.js
 
18
  && npm cache clear --force \
19
  && chown -R rocketchat:rocketchat /app
20
 
21
+ # Install http-proxy to enable reverse proxy
22
+ RUN npm install -g http-proxy
 
 
 
 
23
 
24
+ # Create a proxy script to forward traffic from 7860 to 3000
25
+ RUN echo "\
26
+ const httpProxy = require('http-proxy');\n\
27
+ const proxy = httpProxy.createProxyServer({ target: 'http://localhost:3000' });\n\
28
+ proxy.listen(7860, () => console.log('Proxy server listening on port 7860'));\
29
+ " > /app/proxy.js
30
 
31
  USER rocketchat
32
 
 
43
  ROOT_URL=http://localhost:3000 \
44
  Accounts_AvatarStorePath=/app/uploads
45
 
46
+ # Expose the external port 7860
47
  EXPOSE 7860
48
 
49
+ # Start the proxy server and Rocket.Chat
50
+ CMD node /app/proxy.js & node main.js