File size: 2,584 Bytes
f8454ad
3df5204
f8454ad
 
 
f207cfd
f8454ad
 
 
3df5204
f8454ad
 
 
3df5204
f207cfd
f8454ad
 
 
bf831b3
f8454ad
f207cfd
 
 
26488bb
5552216
 
41bc73a
06d0461
41bc73a
 
 
ef798ec
41bc73a
 
 
 
 
 
 
 
 
 
 
 
06d0461
ef798ec
 
 
 
f8454ad
 
 
 
 
 
26488bb
f8454ad
5552216
 
f8454ad
 
26488bb
f8454ad
5552216
7108661
f8454ad
 
 
3df5204
f8454ad
26488bb
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
FROM ubuntu:latest

# Install essential packages
RUN apt-get update && apt-get install -y \
    curl \
    wget \
    gnupg \
    build-essential \
    graphicsmagick

# Install Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
    apt-get install -y nodejs

# Install MongoDB and dependencies
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
    gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
    --dearmor \
    && echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/8.0 multiverse" | \
    tee /etc/apt/sources.list.d/mongodb-org-8.0.list \
    && wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb \
    && dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb \
    && rm libssl1.1_1.1.1f-1ubuntu2_amd64.deb \
    && apt-get update \
    && apt-get install -y mongodb-org mongodb-mongosh

# Create required directories and set permissions
RUN mkdir -p /data/db /opt/Rocket.Chat /var/log && \
    touch /var/log/mongodb.log && \
    chown -R mongodb:mongodb /data/db /var/log/mongodb.log && \
    chmod 777 /data/db /var/log/mongodb.log

# Create MongoDB config file
RUN echo "storage:" > /etc/mongod.conf && \
    echo "  dbPath: /data/db" >> /etc/mongod.conf && \
    echo "systemLog:" >> /etc/mongod.conf && \
    echo "  destination: file" >> /etc/mongod.conf && \
    echo "  path: /var/log/mongodb.log" >> /etc/mongod.conf && \
    echo "  logAppend: true" >> /etc/mongod.conf && \
    echo "net:" >> /etc/mongod.conf && \
    echo "  bindIp: 127.0.0.1" >> /etc/mongod.conf && \
    echo "  port: 27017" >> /etc/mongod.conf && \
    echo "replication:" >> /etc/mongod.conf && \
    echo "  replSetName: rs01" >> /etc/mongod.conf

# Create rocketchat user
RUN useradd -M rocketchat && \
    usermod -L rocketchat

# Download and install Rocket.Chat
RUN curl -L https://releases.rocket.chat/latest/download -o /tmp/rocket.chat.tgz && \
    tar -xzf /tmp/rocket.chat.tgz -C /opt/Rocket.Chat --strip-components=1 && \
    cd /opt/Rocket.Chat/programs/server && \
    npm install --production && \
    chown -R rocketchat:rocketchat /opt/Rocket.Chat

# Set environment variables
ENV ROOT_URL=http://localhost:7860 \
    PORT=7860 \
    MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 \
    MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01

# Expose necessary ports
EXPOSE 27017 7860

# Copy startup script
COPY start.sh /start.sh
RUN chmod +x /start.sh

ENTRYPOINT ["/start.sh"]