html5: self building for node v12

This commit is contained in:
chandi 2020-05-26 17:30:37 +02:00
parent 36c2aa4453
commit 3a22a510ce
2 changed files with 42 additions and 23 deletions

View File

@ -1,33 +1,52 @@
# TODO: build from github repo with node:12
FROM node:8-stretch
FROM node:12-buster-slim AS builder
ENV NODE_ENV production
RUN apt-get update && apt-get install -y wget curl subversion python2 python3 build-essential
RUN groupadd -g 2000 meteor && useradd -m -u 2001 -g meteor meteor
# download dockerize
ENV DOCKERIZE_VERSION v0.6.1
# install dockerize
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
RUN apt-get update && apt-get install -y wget binutils
RUN useradd -m meteor
# download & install bbb-html5 package manually
RUN PACKAGE_PATH=$(curl -s https://packages-eu.bigbluebutton.org/xenial-22/dists/bigbluebutton-xenial/main/binary-amd64/Packages | grep -E 'Filename.*html5' | awk '{print $2}') \
&& wget https://packages-eu.bigbluebutton.org/xenial-22/$PACKAGE_PATH \
&& ar x bbb-html5_*.deb \
&& tar -zxf data.tar.gz ./usr/share/meteor/bundle \
&& mv /usr/share/meteor/bundle /app \
&& rm -rf /app/programs/server/node_modules \
&& chown meteor:meteor /app/programs/server \
&& chown -R meteor:meteor /app/programs/server/assets/app/config \
&& rm /*.deb /*.tar.gz
USER meteor
RUN cd /app/programs/server && npm install && npm cache clear --force
ENV METEOR_VERSION 1.9
RUN curl -sL https://install.meteor.com?release=$METEOR_VERSION | sed s/--progress-bar/-sL/g | /bin/sh
ENV TAG v2.2.14
RUN cd ~ \
&& svn checkout https://github.com/bigbluebutton/bigbluebutton/tags/$TAG/bigbluebutton-html5 \
&& mv ~/bigbluebutton-html5 ~/source \
&& rm -rf ~/source/.svn
# source modifications for node v12 support:
# - remove memwatch since it is not available for node v12 and disabled anyway
# - set meteor release to 1.9
# - install newer fibers version (4.0.3) which supports node v12
RUN sed -i -r 's/import (memwatch|heapdump).*//g' ~/source/imports/startup/server/index.js \
&& sed -i -r 's/.*(memwatch|heapdump).*//g' ~/source/package.json \
&& echo "METEOR@$METEOR_VERSION" > ~/source/.meteor/release \
&& cat ~/source/.meteor/release
RUN cd ~/source \
&& npm install fibers@4.0.3 --production --save \
&& ~/.meteor/meteor npm install --production \
&& ~/.meteor/meteor build --directory ~/app \
&& rm -r ~/source
RUN cd ~/app/bundle/programs/server \
&& npm install --production
# ------------------------------
FROM node:12-alpine
RUN addgroup -g 2000 meteor && adduser -D -u 2001 -G meteor meteor
COPY --from=builder /usr/local/bin/dockerize /usr/local/bin/dockerize
COPY --from=builder --chown=meteor:meteor /home/meteor/app/bundle /app
COPY entrypoint.sh /entrypoint.sh
COPY settings.yml /app/programs/server/assets/app/config/settings.yml.tmpl
USER meteor
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
cd /app
export ROOT_URL=http://127.0.0.1/html5client
@ -7,7 +7,7 @@ export NODE_ENV=production
export ENVIRONMENT_TYPE=production
export PORT=3000
rm /app/programs/server/assets/app/config/settings.yml
rm -f /app/programs/server/assets/app/config/settings.yml
dockerize \
-template /app/programs/server/assets/app/config/settings.yml.tmpl:/app/programs/server/assets/app/config/settings.yml \
node main.js