anuj commited on
Commit
26488bb
1 Parent(s): 4b723f2
Files changed (2) hide show
  1. Dockerfile +58 -0
  2. start.sh +14 -0
Dockerfile ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Ubuntu as base image
2
+ FROM ubuntu:22.04
3
+
4
+ # Prevent interactive prompts during package installation
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+
7
+ # Install necessary dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ curl \
10
+ gnupg \
11
+ build-essential \
12
+ graphicsmagick \
13
+ python3 \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Install libssl1.1
17
+ RUN curl -fsSL http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb -o libssl1.1.deb && \
18
+ dpkg -i libssl1.1.deb && \
19
+ rm libssl1.1.deb
20
+
21
+ # Add MongoDB repository and install MongoDB
22
+ RUN curl -fsSL https://pgp.mongodb.com/server-5.0.asc | gpg --dearmor -o /usr/share/keyrings/mongodb-archive-keyring.gpg \
23
+ && echo "deb [signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg] http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list \
24
+ && apt-get update \
25
+ && apt-get install -y mongodb-org \
26
+ && rm -rf /var/lib/apt/lists/*
27
+
28
+ # Create MongoDB data directory
29
+ RUN mkdir -p /data/db
30
+
31
+ # Install Node.js (required for Rocket.Chat)
32
+ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
33
+ && apt-get install -y nodejs
34
+
35
+ # Create Rocket.Chat directory
36
+ WORKDIR /app
37
+
38
+ # Download and install Rocket.Chat
39
+ RUN curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz \
40
+ && tar zxvf rocket.chat.tgz \
41
+ && cd bundle/programs/server \
42
+ && npm install --production
43
+
44
+ # Set environment variables
45
+ ENV PORT=3000 \
46
+ ROOT_URL=http://localhost:3000 \
47
+ MONGO_URL=mongodb://localhost:27017/rocketchat \
48
+ MONGO_OPLOG_URL=mongodb://localhost:27017/local
49
+
50
+ # Copy startup script
51
+ COPY start.sh /start.sh
52
+ RUN chmod +x /start.sh
53
+
54
+ # Expose port
55
+ EXPOSE 3000
56
+
57
+ # Start MongoDB and Rocket.Chat
58
+ CMD ["/start.sh"]
start.sh ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Start MongoDB
4
+ mongod --replSet rs0 --bind_ip_all &
5
+
6
+ # Wait for MongoDB to start
7
+ sleep 10
8
+
9
+ # Initialize replica set
10
+ mongosh --eval "rs.initiate({_id: 'rs0', members: [{_id: 0, host: 'localhost:27017'}]})"
11
+
12
+ # Start Rocket.Chat
13
+ cd /app/bundle
14
+ node main.js