Spaces:
Runtime error
Runtime error
anuj
commited on
Commit
•
3df5204
1
Parent(s):
046867d
batman
Browse files- Dockerfile +110 -57
- start-mongodb.sh +14 -0
Dockerfile
CHANGED
@@ -1,63 +1,116 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
ENV
|
6 |
-
|
7 |
-
#
|
8 |
-
RUN
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
&& apt-get update \
|
26 |
&& apt-get install -y mongodb-org \
|
27 |
-
&&
|
|
|
28 |
|
29 |
-
#
|
30 |
-
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
RUN mkdir -p /data/db /.mongodb && \
|
35 |
-
useradd -ms /bin/bash rocketchat && \
|
36 |
-
chown -R mongodb:mongodb /data/db /.mongodb
|
37 |
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
|
42 |
-
RUN curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz \
|
43 |
-
&& tar zxvf rocket.chat.tgz \
|
44 |
-
&& rm rocket.chat.tgz \
|
45 |
-
&& cd bundle/programs/server \
|
46 |
-
&& npm install --production \
|
47 |
-
&& chown -R rocketchat:rocketchat /app
|
48 |
-
|
49 |
-
# Set environment variables
|
50 |
-
ENV PORT=3000 \
|
51 |
-
ROOT_URL=http://localhost:3000 \
|
52 |
-
MONGO_URL=mongodb://localhost:27017/rocketchat \
|
53 |
-
MONGO_OPLOG_URL=mongodb://localhost:27017/local
|
54 |
-
|
55 |
-
# Copy startup script
|
56 |
-
COPY start.sh /start.sh
|
57 |
-
RUN chmod +x /start.sh
|
58 |
-
|
59 |
-
# Expose port
|
60 |
-
EXPOSE 3000
|
61 |
-
|
62 |
-
# Start MongoDB and Rocket.Chat
|
63 |
-
CMD ["/start.sh"]
|
|
|
1 |
+
FROM debian:bullseye-slim
|
2 |
+
|
3 |
+
## Installing Node.js
|
4 |
+
ENV NODE_ENV production
|
5 |
+
ENV NODE_VERSION 14.21.3
|
6 |
+
|
7 |
+
# Node installation based on https://github.com/nodejs/docker-node/blob/66b46292a6e5dd5856b1d5204dc51547c80eb17a/12/buster-slim/Dockerfile
|
8 |
+
RUN ARCH="x64" \
|
9 |
+
&& set -eux \
|
10 |
+
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates curl wget gnupg dirmngr xz-utils \
|
11 |
+
&& rm -rf /var/lib/apt/lists/* \
|
12 |
+
&& for key in \
|
13 |
+
4ED778F539E3634C779C87C6D7062848A1AB005C \
|
14 |
+
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
|
15 |
+
74F12602B6F1C4E913FAA37AD3A89613643B6201 \
|
16 |
+
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
|
17 |
+
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
|
18 |
+
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
|
19 |
+
C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \
|
20 |
+
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
|
21 |
+
A48C2BEE680E841632CD4E44F07496B3EB3C1762 \
|
22 |
+
108F52B48DB57BB0CC439B2997B01419BD92F80A \
|
23 |
+
B9E2F5981AA6E0CD28160D9FF13993A75599653C \
|
24 |
+
; do \
|
25 |
+
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \
|
26 |
+
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \
|
27 |
+
done \
|
28 |
+
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
|
29 |
+
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
|
30 |
+
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
|
31 |
+
&& grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
|
32 |
+
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
|
33 |
+
&& rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \
|
34 |
+
&& apt-mark auto '.*' > /dev/null \
|
35 |
+
&& find /usr/local -type f -executable -exec ldd '{}' ';' \
|
36 |
+
| awk '/=>/ { print $(NF-1) }' \
|
37 |
+
| sort -u \
|
38 |
+
| xargs -r dpkg-query --search \
|
39 |
+
| cut -d: -f1 \
|
40 |
+
| sort -u \
|
41 |
+
| xargs -r apt-mark manual \
|
42 |
+
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
|
43 |
+
|
44 |
+
RUN groupadd -r rocketchat \
|
45 |
+
&& useradd -r -g rocketchat rocketchat \
|
46 |
+
&& mkdir -p /app/uploads \
|
47 |
+
&& chown rocketchat:rocketchat /app/uploads
|
48 |
+
|
49 |
+
VOLUME /app/uploads
|
50 |
+
|
51 |
+
ENV RC_VERSION 6.11.1
|
52 |
+
|
53 |
+
WORKDIR /app
|
54 |
+
|
55 |
+
RUN set -eux \
|
56 |
+
&& apt-get update \
|
57 |
+
&& apt-get install -y --no-install-recommends fontconfig \
|
58 |
+
&& aptMark="$(apt-mark showmanual)" \
|
59 |
+
&& apt-get install -y --no-install-recommends g++ make python3 ca-certificates curl gnupg \
|
60 |
+
&& rm -rf /var/lib/apt/lists/* \
|
61 |
+
# gpg: key 4FD08104: public key "Rocket.Chat Buildmaster <buildmaster@rocket.chat>" imported
|
62 |
+
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 0E163286C20D07B9787EBE9FD7F9D0414FD08104 \
|
63 |
+
&& curl -fSL "https://releases.rocket.chat/${RC_VERSION}/download" -o rocket.chat.tgz \
|
64 |
+
&& curl -fSL "https://releases.rocket.chat/${RC_VERSION}/asc" -o rocket.chat.tgz.asc \
|
65 |
+
&& gpg --batch --verify rocket.chat.tgz.asc rocket.chat.tgz \
|
66 |
+
&& tar zxf rocket.chat.tgz \
|
67 |
+
&& rm rocket.chat.tgz rocket.chat.tgz.asc \
|
68 |
+
&& cd bundle/programs/server \
|
69 |
+
&& npm install --unsafe-perm=true \
|
70 |
+
&& apt-mark auto '.*' > /dev/null \
|
71 |
+
&& apt-mark manual $aptMark > /dev/null \
|
72 |
+
&& find /usr/local -type f -executable -exec ldd '{}' ';' \
|
73 |
+
| awk '/=>/ { print $(NF-1) }' \
|
74 |
+
| sort -u \
|
75 |
+
| xargs -r dpkg-query --search \
|
76 |
+
| cut -d: -f1 \
|
77 |
+
| sort -u \
|
78 |
+
| xargs -r apt-mark manual \
|
79 |
+
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
|
80 |
+
&& npm cache clear --force \
|
81 |
+
&& chown -R rocketchat:rocketchat /app
|
82 |
+
|
83 |
+
# Temporarily switch back to root for MongoDB installation
|
84 |
+
USER root
|
85 |
+
|
86 |
+
# Install MongoDB
|
87 |
+
RUN apt-get update && apt-get install -y gnupg curl \
|
88 |
+
&& curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
|
89 |
+
gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
|
90 |
+
--dearmor \
|
91 |
+
&& echo "deb [signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg] https://repo.mongodb.org/apt/debian bullseye/mongodb-org/8.0 main" | \
|
92 |
+
tee /etc/apt/sources.list.d/mongodb-org-8.0.list \
|
93 |
&& apt-get update \
|
94 |
&& apt-get install -y mongodb-org \
|
95 |
+
&& mkdir -p /data/db \
|
96 |
+
&& chown -R rocketchat:rocketchat /data/db
|
97 |
|
98 |
+
# Create MongoDB startup script
|
99 |
+
COPY start-mongodb.sh /usr/local/bin/
|
100 |
+
RUN chmod +x /usr/local/bin/start-mongodb.sh
|
101 |
|
102 |
+
USER root
|
|
|
|
|
|
|
103 |
|
104 |
+
WORKDIR /app/bundle
|
105 |
+
|
106 |
+
# needs a mongoinstance - defaults to container linking with alias 'db'
|
107 |
+
ENV DEPLOY_METHOD=docker-official \
|
108 |
+
MONGO_URL=mongodb://localhost:27017/meteor \
|
109 |
+
HOME=/tmp \
|
110 |
+
PORT=7860 \
|
111 |
+
ROOT_URL=http://localhost:7860 \
|
112 |
+
Accounts_AvatarStorePath=/app/uploads
|
113 |
+
|
114 |
+
EXPOSE 7860
|
115 |
|
116 |
+
CMD ["/bin/bash", "/usr/local/bin/start-mongodb.sh"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start-mongodb.sh
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Start MongoDB
|
4 |
+
mongod --fork --logpath /var/log/mongodb.log
|
5 |
+
|
6 |
+
# Wait for MongoDB to be ready
|
7 |
+
until mongosh --eval "print(\"waited for connection\")" > /dev/null 2>&1; do
|
8 |
+
echo "Waiting for MongoDB to be ready..."
|
9 |
+
sleep 1
|
10 |
+
done
|
11 |
+
|
12 |
+
su rocketchat
|
13 |
+
# Start the Node.js application
|
14 |
+
exec node /app/bundle/main.js
|