File size: 2,020 Bytes
26488bb
 
 
 
 
 
 
7108661
 
 
26488bb
 
7108661
26488bb
 
 
 
 
 
 
7108661
 
 
26488bb
 
 
 
7108661
26488bb
 
 
7108661
 
 
 
 
 
26488bb
 
 
 
 
 
7108661
26488bb
7108661
 
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
# Use Ubuntu as base image
FROM ubuntu:22.04

# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive

# Install necessary dependencies
RUN mkdir -p /var/lib/apt/lists/partial && \
    apt-get clean && \
    apt-get update && apt-get install -y \
    curl \
    gnupg \
    supervisor \
    && rm -rf /var/lib/apt/lists/*

# Install libssl1.1
RUN curl -fsSL http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb -o libssl1.1.deb && \
    dpkg -i libssl1.1.deb && \
    rm libssl1.1.deb

# Add MongoDB repository and install MongoDB 6.0
RUN curl -fsSL https://pgp.mongodb.com/server-6.0.asc | gpg --dearmor -o /usr/share/keyrings/mongodb-archive-keyring.gpg \
    && echo "deb [signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg] http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list \
    && apt-get update \
    && apt-get install -y mongodb-org \
    && rm -rf /var/lib/apt/lists/*

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

# Create directories and set permissions
RUN mkdir -p /data/db /.mongodb && \
    useradd -ms /bin/bash rocketchat && \
    useradd -ms /bin/bash mongodb && \
    chown -R mongodb:mongodb /data/db /.mongodb

# Create Rocket.Chat directory
WORKDIR /app

# Download and install Rocket.Chat
RUN curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz \
    && tar zxvf rocket.chat.tgz \
    && rm rocket.chat.tgz \
    && cd bundle/programs/server \
    && npm install --production \
    && chown -R rocketchat:rocketchat /app

# Set environment variables
ENV PORT=3000 \
    ROOT_URL=http://localhost:3000 \
    MONGO_URL=mongodb://localhost:27017/rocketchat \
    MONGO_OPLOG_URL=mongodb://localhost:27017/local

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

# Expose port
EXPOSE 3000

# Start MongoDB and Rocket.Chat
CMD ["/start.sh"]