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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -27
Dockerfile CHANGED
@@ -1,32 +1,34 @@
1
- # Base image for Rocket.Chat
2
  FROM rocketchat/base:8
3
 
4
  ENV RC_VERSION 0.65.2
5
 
6
  MAINTAINER [email protected]
7
 
8
- # Install Rocket.Chat
9
- RUN set -x \
10
- && curl -SLf "https://releases.rocket.chat/${RC_VERSION}/download/" -o rocket.chat.tgz \
11
- && curl -SLf "https://releases.rocket.chat/${RC_VERSION}/asc" -o rocket.chat.tgz.asc \
12
- && gpg --verify rocket.chat.tgz.asc \
13
- && mkdir -p /app \
14
- && tar -zxf rocket.chat.tgz -C /app \
15
- && rm rocket.chat.tgz rocket.chat.tgz.asc \
16
- && cd /app/bundle/programs/server \
17
- && npm install \
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
 
@@ -34,17 +36,17 @@ VOLUME /app/uploads
34
 
35
  WORKDIR /app/bundle
36
 
37
- # Environment settings for Rocket.Chat
38
  ENV DEPLOY_METHOD=docker \
39
  NODE_ENV=production \
40
  MONGO_URL=mongodb://mongo:27017/rocketchat \
41
  HOME=/tmp \
42
- PORT=3000 \
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
 
 
1
  FROM rocketchat/base:8
2
 
3
  ENV RC_VERSION 0.65.2
4
 
5
  MAINTAINER [email protected]
6
 
7
+ # Install http-proxy for port forwarding
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  RUN npm install -g http-proxy
9
 
10
+ # Original RocketChat installation
11
+ RUN set -x \
12
+ && curl -SLf "https://releases.rocket.chat/${RC_VERSION}/download/" -o rocket.chat.tgz \
13
+ && curl -SLf "https://releases.rocket.chat/${RC_VERSION}/asc" -o rocket.chat.tgz.asc \
14
+ && gpg --verify rocket.chat.tgz.asc \
15
+ && mkdir -p /app \
16
+ && tar -zxf rocket.chat.tgz -C /app \
17
+ && rm rocket.chat.tgz rocket.chat.tgz.asc \
18
+ && cd /app/bundle/programs/server \
19
+ && npm install \
20
+ && npm cache clear --force \
21
+ && chown -R rocketchat:rocketchat /app
22
+
23
+ # Create proxy script
24
+ RUN mkdir -p /app/proxy \
25
+ && echo 'const httpProxy = require("http-proxy");' > /app/proxy/proxy.js \
26
+ && echo 'const proxy = httpProxy.createProxyServer({});' >> /app/proxy/proxy.js \
27
+ && echo 'const server = require("http").createServer(function(req, res) {' >> /app/proxy/proxy.js \
28
+ && echo ' proxy.web(req, res, { target: "http://localhost:7860" });' >> /app/proxy/proxy.js \
29
+ && echo '});' >> /app/proxy/proxy.js \
30
+ && echo 'console.log("Proxy server listening on port 3000");' >> /app/proxy/proxy.js \
31
+ && echo 'server.listen(3000);' >> /app/proxy/proxy.js
32
 
33
  USER rocketchat
34
 
 
36
 
37
  WORKDIR /app/bundle
38
 
39
+ # Modified environment variables to accommodate proxy
40
  ENV DEPLOY_METHOD=docker \
41
  NODE_ENV=production \
42
  MONGO_URL=mongodb://mongo:27017/rocketchat \
43
  HOME=/tmp \
44
+ PORT=7860 \
45
  ROOT_URL=http://localhost:3000 \
46
  Accounts_AvatarStorePath=/app/uploads
47
 
48
+ # Expose both ports
49
+ EXPOSE 3000 7860
50
 
51
+ # Modified startup command to run both the proxy and RocketChat
52
+ CMD ["sh", "-c", "node ../proxy/proxy.js & node main.js"]