File size: 1,835 Bytes
f8454ad
3df5204
f8454ad
 
 
f207cfd
f8454ad
 
 
3df5204
f8454ad
 
 
3df5204
f207cfd
f8454ad
 
 
bf831b3
f8454ad
f207cfd
 
 
26488bb
f8454ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26488bb
f8454ad
 
 
 
 
26488bb
f8454ad
 
7108661
f8454ad
 
 
3df5204
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
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

# Create required directories
RUN mkdir -p /data/db /opt/Rocket.Chat

# 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:3000 \
    PORT=3000 \
    MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 \
    MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01

# Expose necessary ports
EXPOSE 27017 3000

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

# Switch to non-root user
USER rocketchat

ENTRYPOINT ["/start.sh"]