rocket-chat-demo / Dockerfile
anuj
batman
3547cc1
raw
history blame
1.95 kB
# Use Ubuntu as base image
FROM ubuntu:22.04
# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install necessary dependencies
RUN apt-get update && apt-get install -y \
curl \
gnupg \
build-essential \
graphicsmagick \
python3 \
&& 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
RUN curl -fsSL https://pgp.mongodb.com/server-5.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/5.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list \
&& apt-get update \
&& apt-get install -y mongodb-org \
&& rm -rf /var/lib/apt/lists/*
# Create MongoDB data directory with correct permissions
RUN mkdir -p /data/db /.mongodb && \
chown -R mongodb:mongodb /data/db /.mongodb
# Create Rocket.Chat user
RUN useradd -ms /bin/bash rocketchat
USER mongodb
# Install Node.js (required for Rocket.Chat)
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs
# 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 \
&& cd bundle/programs/server \
&& npm install --production
# 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"]