Spaces:
Runtime error
Runtime error
# 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"] |