File size: 1,775 Bytes
a85282b
 
 
 
 
 
fff6118
843d79d
aaac850
fff6118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
762fb69
a85282b
 
 
 
 
 
fff6118
a85282b
 
 
 
fff6118
a85282b
 
 
fff6118
 
a85282b
fff6118
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
FROM rocketchat/base:8

ENV RC_VERSION 0.65.2

MAINTAINER [email protected]

# Install http-proxy for port forwarding
RUN npm install -g http-proxy

# Original RocketChat installation
RUN set -x \
    && curl -SLf "https://releases.rocket.chat/${RC_VERSION}/download/" -o rocket.chat.tgz \
    && curl -SLf "https://releases.rocket.chat/${RC_VERSION}/asc" -o rocket.chat.tgz.asc \
    && gpg --verify rocket.chat.tgz.asc \
    && mkdir -p /app \
    && tar -zxf rocket.chat.tgz -C /app \
    && rm rocket.chat.tgz rocket.chat.tgz.asc \
    && cd /app/bundle/programs/server \
    && npm install \
    && npm cache clear --force \
    && chown -R rocketchat:rocketchat /app

# Create proxy script
RUN mkdir -p /app/proxy \
    && echo 'const httpProxy = require("http-proxy");' > /app/proxy/proxy.js \
    && echo 'const proxy = httpProxy.createProxyServer({});' >> /app/proxy/proxy.js \
    && echo 'const server = require("http").createServer(function(req, res) {' >> /app/proxy/proxy.js \
    && echo '  proxy.web(req, res, { target: "http://localhost:7860" });' >> /app/proxy/proxy.js \
    && echo '});' >> /app/proxy/proxy.js \
    && echo 'console.log("Proxy server listening on port 3000");' >> /app/proxy/proxy.js \
    && echo 'server.listen(3000);' >> /app/proxy/proxy.js

USER rocketchat

VOLUME /app/uploads

WORKDIR /app/bundle

# Modified environment variables to accommodate proxy
ENV DEPLOY_METHOD=docker \
    NODE_ENV=production \
    MONGO_URL=mongodb://mongo:27017/rocketchat \
    HOME=/tmp \
    PORT=7860 \
    ROOT_URL=http://localhost:3000 \
    Accounts_AvatarStorePath=/app/uploads

# Expose both ports
EXPOSE 3000 7860

# Modified startup command to run both the proxy and RocketChat
CMD ["sh", "-c", "node ../proxy/proxy.js & node main.js"]