diff --git a/Dockerfile b/Dockerfile index 37a63fb3..cb2382cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ COPY --from=bbb-playback /etc/bigbluebutton/nginx /etc/bigbluebutton/nginx/ COPY --from=bbb-playback /var/bigbluebutton/playback /var/bigbluebutton/playback/ COPY nginx/start /etc/nginx/start COPY nginx/dhparam.pem /etc/nginx/dhparam.pem -COPY nginx/conf.d /etc/nginx/http.d/ +COPY nginx/http.d /etc/nginx/http.d/ EXPOSE 80 EXPOSE 443 ENV NGINX_HOSTNAME=localhost diff --git a/dockerfiles/v1/bionic230-alpine b/dockerfiles/v1/bionic230-alpine index eafcd866..290e555f 100644 --- a/dockerfiles/v1/bionic230-alpine +++ b/dockerfiles/v1/bionic230-alpine @@ -1,4 +1,4 @@ -FROM alpine:3.13 AS alpine +FROM alpine:3.15 AS alpine FROM ubuntu:18.04 AS bbb-playback ENV DEBIAN_FRONTEND=noninteractive @@ -24,34 +24,46 @@ FROM alpine AS nginx RUN apk add --no-cache nginx tini gettext \ && ln -sf /dev/stdout /var/log/nginx/access.log \ && ln -sf /dev/stderr /var/log/nginx/error.log -RUN rm /etc/nginx/conf.d/default.conf +RUN rm /etc/nginx/http.d/default.conf COPY --from=bbb-playback /etc/bigbluebutton/nginx /etc/bigbluebutton/nginx/ COPY --from=bbb-playback /var/bigbluebutton/playback /var/bigbluebutton/playback/ COPY nginx/start /etc/nginx/start COPY nginx/dhparam.pem /etc/nginx/dhparam.pem -COPY nginx/conf.d /etc/nginx/http.d/ -# This will be needed with alpine 3.14 since conf.d is being phased out. -# RUN ln -s /etc/nginx/http.d/ /etc/nginx/conf.d +COPY nginx/http.d /etc/nginx/http.d/ EXPOSE 80 EXPOSE 443 ENV NGINX_HOSTNAME=localhost CMD [ "/etc/nginx/start", "-g", "daemon off;" ] FROM alpine AS base -RUN apk add --no-cache \ - libpq RUN apk add --no-cache \ libpq \ libxml2 \ libxslt \ - ruby \ - ruby-irb \ - ruby-bigdecimal \ - ruby-bundler \ - ruby-json \ tini \ tzdata \ shared-mime-info +# ruby-start. +# Install Ruby from sources since Scalelite does not use the version shipped with Apline. +ARG RUBY_RELEASE="https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.6.tar.gz" +ARG RUBY="ruby-2.7.6" +RUN apk add --no-cache git make gcc g++ libc-dev pkgconfig \ + libxml2-dev libxslt-dev postgresql-dev coreutils curl wget bash \ + gnupg tar linux-headers bison readline-dev readline zlib-dev \ + zlib yaml-dev autoconf ncurses-dev curl-dev apache2-dev \ + libx11-dev libffi-dev tcl-dev tk-dev +RUN wget --no-verbose -O ruby.tar.gz ${RUBY_RELEASE} && \ + tar -xf ruby.tar.gz && \ + cd /${RUBY} && \ + ac_cv_func_isnan=yes ac_cv_func_isinf=yes \ + ./configure --disable-install-doc && \ + make && \ + make test && \ + make install +RUN cd / && \ + rm ruby.tar.gz && \ + rm -rf ${RUBY_NAME} +# ruby-end. RUN addgroup scalelite --gid 1000 && \ adduser -u 1000 -h /srv/scalelite -G scalelite -D scalelite RUN addgroup scalelite-spool --gid 2000 && \ diff --git a/dockerfiles/v1/bionic230-amazonlinux b/dockerfiles/v1/bionic230-amazonlinux index 987b1547..93c05968 100644 --- a/dockerfiles/v1/bionic230-amazonlinux +++ b/dockerfiles/v1/bionic230-amazonlinux @@ -1,4 +1,4 @@ -FROM amazonlinux:2.0.20211201.0 AS amazonlinux +FROM amazonlinux:2.0.20221004.0 AS amazonlinux FROM ubuntu:18.04 AS bbb-playback ENV DEBIAN_FRONTEND=noninteractive @@ -30,15 +30,18 @@ RUN chmod +x /sbin/tini RUN yum -y install redhat-rpm-config FROM amazonlinux-base AS nginx -RUN yes | amazon-linux-extras install nginx1 RUN yum -y install gettext +COPY nginx/nginx.repo /etc/yum.repos.d/nginx.repo +RUN yum install yum-utils -y +RUN yum install nginx -y RUN ln -sf /dev/stdout /var/log/nginx/access.log RUN ln -sf /dev/stderr /var/log/nginx/error.log COPY --from=bbb-playback /etc/bigbluebutton/nginx /etc/bigbluebutton/nginx/ COPY --from=bbb-playback /var/bigbluebutton/playback /var/bigbluebutton/playback/ COPY nginx/start /etc/nginx/start COPY nginx/dhparam.pem /etc/nginx/dhparam.pem -COPY nginx/conf.d /etc/nginx/conf.d/ +COPY nginx/http.d /etc/nginx/http.d/ +RUN rm -r /etc/nginx/conf.d; ln -s /etc/nginx/http.d/ /etc/nginx/conf.d EXPOSE 80 EXPOSE 443 ENV NGINX_HOSTNAME=localhost @@ -51,9 +54,10 @@ RUN curl -sL https://rpm.nodesource.com/setup_16.x | bash - RUN yum -y install nodejs # Install Ruby & Rails RUN curl -sL -o /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo -RUN amazon-linux-extras enable ruby2.6 \ - && yum -y install git tar gzip yarn shared-mime-info libxslt zlib-devel sqlite-devel mariadb-devel postgresql-devel ruby-devel rubygems-devel rubygem-bundler rubygem-io-console rubygem-irb rubygem-json rubygem-minitest rubygem-net-http-persistent rubygem-net-telnet rubygem-power_assert rubygem-rake rubygem-test-unit rubygem-thor rubygem-xmlrpc rubygem-bigdecimal +RUN amazon-linux-extras enable ruby2.6 postgresql14 \ + && yum -y install git tar gzip yarn shared-mime-info libxslt zlib-devel sqlite-devel mariadb-devel libpq-devel ruby-devel rubygems-devel rubygem-bundler rubygem-io-console rubygem-irb rubygem-json rubygem-minitest rubygem-power_assert rubygem-rake rubygem-test-unit rubygem-bigdecimal RUN yum -y install python3 python3-pip shadow-utils +RUN gem install bundler -v '2.1.4' RUN groupadd scalelite --gid 1000 && \ useradd -u 1000 -d /srv/scalelite -g scalelite scalelite RUN groupadd scalelite-spool --gid 2000 && \ @@ -61,14 +65,17 @@ RUN groupadd scalelite-spool --gid 2000 && \ WORKDIR /srv/scalelite FROM base as builder +RUN rm -rf nginx USER scalelite:scalelite COPY --chown=scalelite:scalelite Gemfile* ./ -RUN bundle config build.nokogiri --use-system-libraries \ - && bundle install --deployment --without development:test -j4 \ - && rm -rf vendor/bundle/ruby/*/cache \ - && find vendor/bundle/ruby/*/gems/ \( -name '*.c' -o -name '*.o' \) -delete +RUN bundle --version +RUN bundle config build.nokogiri --use-system-libraries +RUN bundle config set --local deployment 'true' +RUN bundle config set --local without 'development:test' +RUN bundle install -j4 +RUN rm -rf vendor/bundle/ruby/*/cache +RUN find vendor/bundle/ruby/*/gems/ \( -name '*.c' -o -name '*.o' \) -delete COPY --chown=scalelite:scalelite . ./ -RUN rm -rf nginx FROM base AS application USER scalelite:scalelite diff --git a/dockerfiles/v1/bionic240-alpine b/dockerfiles/v1/bionic240-alpine index 37a63fb3..cb2382cf 100644 --- a/dockerfiles/v1/bionic240-alpine +++ b/dockerfiles/v1/bionic240-alpine @@ -29,7 +29,7 @@ COPY --from=bbb-playback /etc/bigbluebutton/nginx /etc/bigbluebutton/nginx/ COPY --from=bbb-playback /var/bigbluebutton/playback /var/bigbluebutton/playback/ COPY nginx/start /etc/nginx/start COPY nginx/dhparam.pem /etc/nginx/dhparam.pem -COPY nginx/conf.d /etc/nginx/http.d/ +COPY nginx/http.d /etc/nginx/http.d/ EXPOSE 80 EXPOSE 443 ENV NGINX_HOSTNAME=localhost diff --git a/dockerfiles/v1/bionic240-amazonlinux b/dockerfiles/v1/bionic240-amazonlinux index b6ed4041..9631469f 100644 --- a/dockerfiles/v1/bionic240-amazonlinux +++ b/dockerfiles/v1/bionic240-amazonlinux @@ -40,7 +40,8 @@ COPY --from=bbb-playback /etc/bigbluebutton/nginx /etc/bigbluebutton/nginx/ COPY --from=bbb-playback /var/bigbluebutton/playback /var/bigbluebutton/playback/ COPY nginx/start /etc/nginx/start COPY nginx/dhparam.pem /etc/nginx/dhparam.pem -COPY nginx/conf.d /etc/nginx/conf.d/ +COPY nginx/http.d /etc/nginx/http.d/ +RUN rm -r /etc/nginx/conf.d; ln -s /etc/nginx/http.d/ /etc/nginx/conf.d EXPOSE 80 EXPOSE 443 ENV NGINX_HOSTNAME=localhost diff --git a/dockerfiles/v1/xenial220-alpine b/dockerfiles/v1/xenial220-alpine index c111b708..facefcc5 100644 --- a/dockerfiles/v1/xenial220-alpine +++ b/dockerfiles/v1/xenial220-alpine @@ -1,4 +1,4 @@ -FROM alpine:3.11 AS alpine +FROM alpine:3.15 AS alpine FROM ubuntu:16.04 AS bbb-playback ENV DEBIAN_FRONTEND=noninteractive @@ -17,13 +17,15 @@ RUN apt-get update \ && dpkg -i --force-depends *.deb FROM alpine AS nginx -RUN apk add --no-cache nginx=1.16.1-r6 tini gettext \ +RUN apk add --no-cache nginx tini gettext \ && ln -sf /dev/stdout /var/log/nginx/access.log \ && ln -sf /dev/stderr /var/log/nginx/error.log -RUN rm /etc/nginx/conf.d/default.conf +RUN rm /etc/nginx/http.d/default.conf COPY --from=bbb-playback /etc/bigbluebutton/nginx /etc/bigbluebutton/nginx/ COPY --from=bbb-playback /var/bigbluebutton/playback /var/bigbluebutton/playback/ -COPY nginx /etc/nginx/ +COPY nginx/start /etc/nginx/start +COPY nginx/dhparam.pem /etc/nginx/dhparam.pem +COPY nginx/http.d /etc/nginx/http.d/ EXPOSE 80 EXPOSE 443 ENV NGINX_HOSTNAME=localhost @@ -34,14 +36,30 @@ RUN apk add --no-cache \ libpq \ libxml2 \ libxslt \ - ruby \ - ruby-irb \ - ruby-bigdecimal \ - ruby-bundler \ - ruby-json \ tini \ tzdata \ shared-mime-info +# ruby-start. +# Install Ruby from sources since Scalelite does not use the version shipped with Apline. +ARG RUBY_RELEASE="https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.6.tar.gz" +ARG RUBY="ruby-2.7.6" +RUN apk add --no-cache git make gcc g++ libc-dev pkgconfig \ + libxml2-dev libxslt-dev postgresql-dev coreutils curl wget bash \ + gnupg tar linux-headers bison readline-dev readline zlib-dev \ + zlib yaml-dev autoconf ncurses-dev curl-dev apache2-dev \ + libx11-dev libffi-dev tcl-dev tk-dev +RUN wget --no-verbose -O ruby.tar.gz ${RUBY_RELEASE} && \ + tar -xf ruby.tar.gz && \ + cd /${RUBY} && \ + ac_cv_func_isnan=yes ac_cv_func_isinf=yes \ + ./configure --disable-install-doc && \ + make && \ + make test && \ + make install +RUN cd / && \ + rm ruby.tar.gz && \ + rm -rf ${RUBY_NAME} +# ruby-end. RUN addgroup scalelite --gid 1000 && \ adduser -u 1000 -h /srv/scalelite -G scalelite -D scalelite RUN addgroup scalelite-spool --gid 2000 && \ diff --git a/nginx/conf.d/scalelite-proxy.template b/nginx/http.d/scalelite-proxy.template similarity index 88% rename from nginx/conf.d/scalelite-proxy.template rename to nginx/http.d/scalelite-proxy.template index abbefd6f..f337520e 100644 --- a/nginx/conf.d/scalelite-proxy.template +++ b/nginx/http.d/scalelite-proxy.template @@ -21,6 +21,6 @@ server { proxy_http_version 1.1; } - include conf.d/scalelite/*; - include conf.d/scalelite.common; + include http.d/scalelite/*; + include http.d/scalelite.common; } diff --git a/nginx/conf.d/scalelite-recordings-only.template b/nginx/http.d/scalelite-recordings-only.template similarity index 100% rename from nginx/conf.d/scalelite-recordings-only.template rename to nginx/http.d/scalelite-recordings-only.template diff --git a/nginx/conf.d/scalelite-ssl.template b/nginx/http.d/scalelite-ssl.template similarity index 95% rename from nginx/conf.d/scalelite-ssl.template rename to nginx/http.d/scalelite-ssl.template index 0bb66b49..ef8b2404 100644 --- a/nginx/conf.d/scalelite-ssl.template +++ b/nginx/http.d/scalelite-ssl.template @@ -45,6 +45,6 @@ server { proxy_http_version 1.1; } - include conf.d/scalelite/*; - include conf.d/scalelite.common; + include http.d/scalelite/*; + include http.d/scalelite.common; } diff --git a/nginx/conf.d/scalelite.common b/nginx/http.d/scalelite.common similarity index 100% rename from nginx/conf.d/scalelite.common rename to nginx/http.d/scalelite.common diff --git a/nginx/conf.d/scalelite.template b/nginx/http.d/scalelite.template similarity index 88% rename from nginx/conf.d/scalelite.template rename to nginx/http.d/scalelite.template index e264af69..62e7cd16 100644 --- a/nginx/conf.d/scalelite.template +++ b/nginx/http.d/scalelite.template @@ -21,6 +21,6 @@ server { proxy_http_version 1.1; } - include conf.d/scalelite/*; - include conf.d/scalelite.common; + include http.d/scalelite/*; + include http.d/scalelite.common; } diff --git a/nginx/start b/nginx/start index d01d6266..bd1fb077 100755 --- a/nginx/start +++ b/nginx/start @@ -13,23 +13,23 @@ fi echo "Generating templated nginx configuration..." if [ "$NGINX_RECORDINGS_ONLY" = "true" ] ; then echo "Using nginx recordings only configuration template." - nginx_template=/etc/nginx/conf.d/scalelite-recordings-only.template + nginx_template=/etc/nginx/http.d/scalelite-recordings-only.template elif [ "$NGINX_BEHIND_PROXY" = "true" ] ; then echo "Using proxy configuration template." - nginx_template=/etc/nginx/conf.d/scalelite-proxy.template + nginx_template=/etc/nginx/http.d/scalelite-proxy.template elif [ "$NGINX_SSL" = "true" ] ; then echo "Using SSL configuration template." - nginx_template=/etc/nginx/conf.d/scalelite-ssl.template + nginx_template=/etc/nginx/http.d/scalelite-ssl.template else echo "Using non-SSL configuration template." - nginx_template=/etc/nginx/conf.d/scalelite.template + nginx_template=/etc/nginx/http.d/scalelite.template fi # apply SCALELITE_API port from environment variable or use default port 3000 SCALELITE_API_PORT=${SCALELITE_API_PORT:-3000} export SCALELITE_API_PORT -envsubst '$SCALELITE_API_PORT $URL_HOST' <$nginx_template >/etc/nginx/conf.d/scalelite.conf +envsubst '$SCALELITE_API_PORT $URL_HOST' <$nginx_template >/etc/nginx/http.d/scalelite.conf unset nginx_template mkdir -p /run/nginx