Spaces:
Runtime error
Runtime error
| 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 | |
| # Create required directories | |
| RUN mkdir -p /data/db /opt/Rocket.Chat | |
| # 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:3000 \ | |
| PORT=3000 \ | |
| MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 \ | |
| MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 | |
| # Expose necessary ports | |
| EXPOSE 27017 3000 | |
| # Copy startup script | |
| COPY start.sh /start.sh | |
| RUN chmod +x /start.sh | |
| # Switch to non-root user | |
| USER rocketchat | |
| ENTRYPOINT ["/start.sh"] | |