rocket-chat-demo / Dockerfile
anuj
batfa
41bc73a
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"]