From 0b9e06d6e9767cc2a24781907c6b7f5303d0eaf9 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 29 Nov 2018 11:49:54 +0000 Subject: [PATCH 1/4] Dockerfile: Install (and remove) build dependencies The 'slim' base variants do not provide adequate tooling to build this Docker image. We need to install it before running `npm install` and ensure proper clean-up once we're finished. Signed-off-by: Lee Jones --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 59a5181..37bb940 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,9 @@ ENV RC_VERSION 1.1.1 WORKDIR /app -RUN curl -fSL "https://releases.rocket.chat/${RC_VERSION}/download" -o rocket.chat.tgz \ +RUN BUILDDEPS="python make git g++" \ +&& apt-get update && apt-get install -y --no-install-recommends ${BUILDDEPS} \ +&& curl -fSL "https://releases.rocket.chat/${RC_VERSION}/download" -o rocket.chat.tgz \ && curl -fSL "https://releases.rocket.chat/${RC_VERSION}/asc" -o rocket.chat.tgz.asc \ && gpg --batch --verify rocket.chat.tgz.asc rocket.chat.tgz \ && tar zxvf rocket.chat.tgz \ @@ -44,7 +46,8 @@ RUN curl -fSL "https://releases.rocket.chat/${RC_VERSION}/download" -o rocket.ch && cd bundle/programs/server \ && npm install \ && npm cache clear --force \ -&& chown -R rocketchat:rocketchat /app +&& chown -R rocketchat:rocketchat /app \ +&& apt-get purge -y --auto-remove $BUILDDEPS USER rocketchat From d6d7be559a60e7a01c17353bc59df9f58fac0eb5 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 29 Nov 2018 11:52:38 +0000 Subject: [PATCH 2/4] Dockerfile: Make Docker image building verbose This ensures each command is printed out before it is executed, which leads to a much friendlier log for debugging and the like. Signed-off-by: Lee Jones --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 37bb940..453bdda 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ ENV RC_VERSION 1.1.1 WORKDIR /app -RUN BUILDDEPS="python make git g++" \ +RUN set -x; BUILDDEPS="python make git g++" \ && apt-get update && apt-get install -y --no-install-recommends ${BUILDDEPS} \ && curl -fSL "https://releases.rocket.chat/${RC_VERSION}/download" -o rocket.chat.tgz \ && curl -fSL "https://releases.rocket.chat/${RC_VERSION}/asc" -o rocket.chat.tgz.asc \ From 3c2373c408a150fd901e70cbd1f3e6bb1b78d598 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 29 Nov 2018 11:53:48 +0000 Subject: [PATCH 3/4] Dockerfile: Tell `tar` not to be verbose There is no need to print out the name of every file as it is extracted. This only serves to cloud the log making it unusable. Signed-off-by: Lee Jones --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 453bdda..7cf8f06 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,7 +41,7 @@ RUN set -x; BUILDDEPS="python make git g++" \ && curl -fSL "https://releases.rocket.chat/${RC_VERSION}/download" -o rocket.chat.tgz \ && curl -fSL "https://releases.rocket.chat/${RC_VERSION}/asc" -o rocket.chat.tgz.asc \ && gpg --batch --verify rocket.chat.tgz.asc rocket.chat.tgz \ -&& tar zxvf rocket.chat.tgz \ +&& tar zxf rocket.chat.tgz \ && rm rocket.chat.tgz rocket.chat.tgz.asc \ && cd bundle/programs/server \ && npm install \ From 3c3300778bcd059c92d3e4c0bf9f01dc65ea0353 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 29 Nov 2018 11:55:28 +0000 Subject: [PATCH 4/4] Dockerfile: Rebuild Sharp and GRPC modules Rocket.Chat comes with some modules pre-compiled. Unfortunately only x86_64 modules are supplied. By rebuilding them locally it ensures Rocket.Chat Docker images can be built/run on all platforms. Signed-off-by: Lee Jones --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index 7cf8f06..ebca232 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,6 +47,10 @@ RUN set -x; BUILDDEPS="python make git g++" \ && npm install \ && npm cache clear --force \ && chown -R rocketchat:rocketchat /app \ +&& cd /app/bundle/programs/server/npm \ +&& npm uninstall sharp && npm install sharp \ +&& cd /app/bundle/programs/server/npm \ +&& npm uninstall grpc && npm install grpc \ && apt-get purge -y --auto-remove $BUILDDEPS USER rocketchat