sanjay7178 commited on
Commit
aaac850
·
verified ·
1 Parent(s): a85282b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -19
Dockerfile CHANGED
@@ -18,33 +18,21 @@ RUN set -x \
18
  && npm cache clear --force \
19
  && chown -R rocketchat:rocketchat /app
20
 
21
- # Install NGINX for reverse proxy
22
  RUN apt-get update && \
23
- apt-get install -y nginx && \
24
  rm -rf /var/lib/apt/lists/*
25
 
26
- # Configure NGINX to proxy from port 7860 to Rocket.Chat’s internal port 3000
27
- RUN echo "\
28
- server {\n\
29
- listen 7860;\n\
30
- location / {\n\
31
- proxy_pass http://localhost:3000;\n\
32
- proxy_http_version 1.1;\n\
33
- proxy_set_header Upgrade \$http_upgrade;\n\
34
- proxy_set_header Connection 'upgrade';\n\
35
- proxy_set_header Host \$host;\n\
36
- proxy_cache_bypass \$http_upgrade;\n\
37
- }\n\
38
- }\n" > /etc/nginx/sites-available/default
39
-
40
- # Run NGINX in the background, then start Rocket.Chat
41
  USER rocketchat
42
 
43
  VOLUME /app/uploads
44
 
45
  WORKDIR /app/bundle
46
 
47
- # needs a mongo instance - defaults to container linking with alias 'mongo'
48
  ENV DEPLOY_METHOD=docker \
49
  NODE_ENV=production \
50
  MONGO_URL=mongodb://mongo:27017/rocketchat \
@@ -53,6 +41,7 @@ ENV DEPLOY_METHOD=docker \
53
  ROOT_URL=http://localhost:3000 \
54
  Accounts_AvatarStorePath=/app/uploads
55
 
 
56
  EXPOSE 7860
57
 
58
- CMD service nginx start && node main.js
 
18
  && npm cache clear --force \
19
  && chown -R rocketchat:rocketchat /app
20
 
21
+ # Install iptables
22
  RUN apt-get update && \
23
+ apt-get install -y iptables && \
24
  rm -rf /var/lib/apt/lists/*
25
 
26
+ # Set up iptables rule to redirect port 7860 to 3000
27
+ RUN iptables -t nat -A PREROUTING -p tcp --dport 7860 -j REDIRECT --to-port 3000
28
+
 
 
 
 
 
 
 
 
 
 
 
 
29
  USER rocketchat
30
 
31
  VOLUME /app/uploads
32
 
33
  WORKDIR /app/bundle
34
 
35
+ # Environment settings for Rocket.Chat
36
  ENV DEPLOY_METHOD=docker \
37
  NODE_ENV=production \
38
  MONGO_URL=mongodb://mongo:27017/rocketchat \
 
41
  ROOT_URL=http://localhost:3000 \
42
  Accounts_AvatarStorePath=/app/uploads
43
 
44
+ # Expose the external port 7860
45
  EXPOSE 7860
46
 
47
+ CMD ["node", "main.js"]