Skip to content

Commit 76481a5

Browse files
committed
fix #845 and cleanup
There were more issues with the alpine nginx images than I first realised. This patch: - Moves nginx/conf.d to nginx/http.d because that is how the directory is now called within images - Fixes the nginx/start script to work with /etc/nginx/http.d instead of the deprecated and missing /etc/nginx/conf.d - Fixes alpine-based Dockerfiles to copy config files from/to the correct locations - Fixes amazonlinux-based Dockerfiles to also store config in /etc/nginx/http.d so nginx/start works as expeted - Harmonized files in dockerfiles/v1/. Lots of changes in the past were not ported to all of these files. They should only differ in the base image used (alpine/amazonlinux) and the bbb-playback target. Base image versions or other details should be the same.
1 parent b1ea9ca commit 76481a5

12 files changed

+83
-45
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ COPY --from=bbb-playback /etc/bigbluebutton/nginx /etc/bigbluebutton/nginx/
2929
COPY --from=bbb-playback /var/bigbluebutton/playback /var/bigbluebutton/playback/
3030
COPY nginx/start /etc/nginx/start
3131
COPY nginx/dhparam.pem /etc/nginx/dhparam.pem
32-
COPY nginx/conf.d /etc/nginx/http.d/
32+
COPY nginx/http.d /etc/nginx/http.d/
3333
EXPOSE 80
3434
EXPOSE 443
3535
ENV NGINX_HOSTNAME=localhost

dockerfiles/v1/bionic230-alpine

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.13 AS alpine
1+
FROM alpine:3.15 AS alpine
22

33
FROM ubuntu:18.04 AS bbb-playback
44
ENV DEBIAN_FRONTEND=noninteractive
@@ -24,34 +24,46 @@ FROM alpine AS nginx
2424
RUN apk add --no-cache nginx tini gettext \
2525
&& ln -sf /dev/stdout /var/log/nginx/access.log \
2626
&& ln -sf /dev/stderr /var/log/nginx/error.log
27-
RUN rm /etc/nginx/conf.d/default.conf
27+
RUN rm /etc/nginx/http.d/default.conf
2828
COPY --from=bbb-playback /etc/bigbluebutton/nginx /etc/bigbluebutton/nginx/
2929
COPY --from=bbb-playback /var/bigbluebutton/playback /var/bigbluebutton/playback/
3030
COPY nginx/start /etc/nginx/start
3131
COPY nginx/dhparam.pem /etc/nginx/dhparam.pem
32-
COPY nginx/conf.d /etc/nginx/http.d/
33-
# This will be needed with alpine 3.14 since conf.d is being phased out.
34-
# RUN ln -s /etc/nginx/http.d/ /etc/nginx/conf.d
32+
COPY nginx/http.d /etc/nginx/http.d/
3533
EXPOSE 80
3634
EXPOSE 443
3735
ENV NGINX_HOSTNAME=localhost
3836
CMD [ "/etc/nginx/start", "-g", "daemon off;" ]
3937

4038
FROM alpine AS base
41-
RUN apk add --no-cache \
42-
libpq
4339
RUN apk add --no-cache \
4440
libpq \
4541
libxml2 \
4642
libxslt \
47-
ruby \
48-
ruby-irb \
49-
ruby-bigdecimal \
50-
ruby-bundler \
51-
ruby-json \
5243
tini \
5344
tzdata \
5445
shared-mime-info
46+
# ruby-start.
47+
# Install Ruby from sources since Scalelite does not use the version shipped with Apline.
48+
ARG RUBY_RELEASE="https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.6.tar.gz"
49+
ARG RUBY="ruby-2.7.6"
50+
RUN apk add --no-cache git make gcc g++ libc-dev pkgconfig \
51+
libxml2-dev libxslt-dev postgresql-dev coreutils curl wget bash \
52+
gnupg tar linux-headers bison readline-dev readline zlib-dev \
53+
zlib yaml-dev autoconf ncurses-dev curl-dev apache2-dev \
54+
libx11-dev libffi-dev tcl-dev tk-dev
55+
RUN wget --no-verbose -O ruby.tar.gz ${RUBY_RELEASE} && \
56+
tar -xf ruby.tar.gz && \
57+
cd /${RUBY} && \
58+
ac_cv_func_isnan=yes ac_cv_func_isinf=yes \
59+
./configure --disable-install-doc && \
60+
make && \
61+
make test && \
62+
make install
63+
RUN cd / && \
64+
rm ruby.tar.gz && \
65+
rm -rf ${RUBY_NAME}
66+
# ruby-end.
5567
RUN addgroup scalelite --gid 1000 && \
5668
adduser -u 1000 -h /srv/scalelite -G scalelite -D scalelite
5769
RUN addgroup scalelite-spool --gid 2000 && \

dockerfiles/v1/bionic230-amazonlinux

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM amazonlinux:2.0.20211201.0 AS amazonlinux
1+
FROM amazonlinux:2.0.20221004.0 AS amazonlinux
22

33
FROM ubuntu:18.04 AS bbb-playback
44
ENV DEBIAN_FRONTEND=noninteractive
@@ -30,15 +30,18 @@ RUN chmod +x /sbin/tini
3030
RUN yum -y install redhat-rpm-config
3131

3232
FROM amazonlinux-base AS nginx
33-
RUN yes | amazon-linux-extras install nginx1
3433
RUN yum -y install gettext
34+
COPY nginx/nginx.repo /etc/yum.repos.d/nginx.repo
35+
RUN yum install yum-utils -y
36+
RUN yum install nginx -y
3537
RUN ln -sf /dev/stdout /var/log/nginx/access.log
3638
RUN ln -sf /dev/stderr /var/log/nginx/error.log
3739
COPY --from=bbb-playback /etc/bigbluebutton/nginx /etc/bigbluebutton/nginx/
3840
COPY --from=bbb-playback /var/bigbluebutton/playback /var/bigbluebutton/playback/
3941
COPY nginx/start /etc/nginx/start
4042
COPY nginx/dhparam.pem /etc/nginx/dhparam.pem
41-
COPY nginx/conf.d /etc/nginx/conf.d/
43+
COPY nginx/http.d /etc/nginx/http.d/
44+
RUN rm -r /etc/nginx/conf.d; ln -s /etc/nginx/http.d/ /etc/nginx/conf.d
4245
EXPOSE 80
4346
EXPOSE 443
4447
ENV NGINX_HOSTNAME=localhost
@@ -51,24 +54,28 @@ RUN curl -sL https://rpm.nodesource.com/setup_16.x | bash -
5154
RUN yum -y install nodejs
5255
# Install Ruby & Rails
5356
RUN curl -sL -o /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo
54-
RUN amazon-linux-extras enable ruby2.6 \
55-
&& 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
57+
RUN amazon-linux-extras enable ruby2.6 postgresql14 \
58+
&& 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
5659
RUN yum -y install python3 python3-pip shadow-utils
60+
RUN gem install bundler -v '2.1.4'
5761
RUN groupadd scalelite --gid 1000 && \
5862
useradd -u 1000 -d /srv/scalelite -g scalelite scalelite
5963
RUN groupadd scalelite-spool --gid 2000 && \
6064
usermod -a -G scalelite-spool scalelite
6165
WORKDIR /srv/scalelite
6266

6367
FROM base as builder
68+
RUN rm -rf nginx
6469
USER scalelite:scalelite
6570
COPY --chown=scalelite:scalelite Gemfile* ./
66-
RUN bundle config build.nokogiri --use-system-libraries \
67-
&& bundle install --deployment --without development:test -j4 \
68-
&& rm -rf vendor/bundle/ruby/*/cache \
69-
&& find vendor/bundle/ruby/*/gems/ \( -name '*.c' -o -name '*.o' \) -delete
71+
RUN bundle --version
72+
RUN bundle config build.nokogiri --use-system-libraries
73+
RUN bundle config set --local deployment 'true'
74+
RUN bundle config set --local without 'development:test'
75+
RUN bundle install -j4
76+
RUN rm -rf vendor/bundle/ruby/*/cache
77+
RUN find vendor/bundle/ruby/*/gems/ \( -name '*.c' -o -name '*.o' \) -delete
7078
COPY --chown=scalelite:scalelite . ./
71-
RUN rm -rf nginx
7279

7380
FROM base AS application
7481
USER scalelite:scalelite

dockerfiles/v1/bionic240-alpine

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ COPY --from=bbb-playback /etc/bigbluebutton/nginx /etc/bigbluebutton/nginx/
2929
COPY --from=bbb-playback /var/bigbluebutton/playback /var/bigbluebutton/playback/
3030
COPY nginx/start /etc/nginx/start
3131
COPY nginx/dhparam.pem /etc/nginx/dhparam.pem
32-
COPY nginx/conf.d /etc/nginx/http.d/
32+
COPY nginx/http.d /etc/nginx/http.d/
3333
EXPOSE 80
3434
EXPOSE 443
3535
ENV NGINX_HOSTNAME=localhost

dockerfiles/v1/bionic240-amazonlinux

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ COPY --from=bbb-playback /etc/bigbluebutton/nginx /etc/bigbluebutton/nginx/
4040
COPY --from=bbb-playback /var/bigbluebutton/playback /var/bigbluebutton/playback/
4141
COPY nginx/start /etc/nginx/start
4242
COPY nginx/dhparam.pem /etc/nginx/dhparam.pem
43-
COPY nginx/conf.d /etc/nginx/conf.d/
43+
COPY nginx/http.d /etc/nginx/http.d/
44+
RUN rm -r /etc/nginx/conf.d; ln -s /etc/nginx/http.d/ /etc/nginx/conf.d
4445
EXPOSE 80
4546
EXPOSE 443
4647
ENV NGINX_HOSTNAME=localhost

dockerfiles/v1/xenial220-alpine

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.11 AS alpine
1+
FROM alpine:3.15 AS alpine
22

33
FROM ubuntu:16.04 AS bbb-playback
44
ENV DEBIAN_FRONTEND=noninteractive
@@ -17,13 +17,15 @@ RUN apt-get update \
1717
&& dpkg -i --force-depends *.deb
1818

1919
FROM alpine AS nginx
20-
RUN apk add --no-cache nginx=1.16.1-r6 tini gettext \
20+
RUN apk add --no-cache nginx tini gettext \
2121
&& ln -sf /dev/stdout /var/log/nginx/access.log \
2222
&& ln -sf /dev/stderr /var/log/nginx/error.log
23-
RUN rm /etc/nginx/conf.d/default.conf
23+
RUN rm /etc/nginx/http.d/default.conf
2424
COPY --from=bbb-playback /etc/bigbluebutton/nginx /etc/bigbluebutton/nginx/
2525
COPY --from=bbb-playback /var/bigbluebutton/playback /var/bigbluebutton/playback/
26-
COPY nginx /etc/nginx/
26+
COPY nginx/start /etc/nginx/start
27+
COPY nginx/dhparam.pem /etc/nginx/dhparam.pem
28+
COPY nginx/http.d /etc/nginx/http.d/
2729
EXPOSE 80
2830
EXPOSE 443
2931
ENV NGINX_HOSTNAME=localhost
@@ -34,14 +36,30 @@ RUN apk add --no-cache \
3436
libpq \
3537
libxml2 \
3638
libxslt \
37-
ruby \
38-
ruby-irb \
39-
ruby-bigdecimal \
40-
ruby-bundler \
41-
ruby-json \
4239
tini \
4340
tzdata \
4441
shared-mime-info
42+
# ruby-start.
43+
# Install Ruby from sources since Scalelite does not use the version shipped with Apline.
44+
ARG RUBY_RELEASE="https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.6.tar.gz"
45+
ARG RUBY="ruby-2.7.6"
46+
RUN apk add --no-cache git make gcc g++ libc-dev pkgconfig \
47+
libxml2-dev libxslt-dev postgresql-dev coreutils curl wget bash \
48+
gnupg tar linux-headers bison readline-dev readline zlib-dev \
49+
zlib yaml-dev autoconf ncurses-dev curl-dev apache2-dev \
50+
libx11-dev libffi-dev tcl-dev tk-dev
51+
RUN wget --no-verbose -O ruby.tar.gz ${RUBY_RELEASE} && \
52+
tar -xf ruby.tar.gz && \
53+
cd /${RUBY} && \
54+
ac_cv_func_isnan=yes ac_cv_func_isinf=yes \
55+
./configure --disable-install-doc && \
56+
make && \
57+
make test && \
58+
make install
59+
RUN cd / && \
60+
rm ruby.tar.gz && \
61+
rm -rf ${RUBY_NAME}
62+
# ruby-end.
4563
RUN addgroup scalelite --gid 1000 && \
4664
adduser -u 1000 -h /srv/scalelite -G scalelite -D scalelite
4765
RUN addgroup scalelite-spool --gid 2000 && \

nginx/conf.d/scalelite-proxy.template renamed to nginx/http.d/scalelite-proxy.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ server {
2121
proxy_http_version 1.1;
2222
}
2323

24-
include conf.d/scalelite/*;
25-
include conf.d/scalelite.common;
24+
include http.d/scalelite/*;
25+
include http.d/scalelite.common;
2626
}

nginx/conf.d/scalelite-ssl.template renamed to nginx/http.d/scalelite-ssl.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ server {
4545
proxy_http_version 1.1;
4646
}
4747

48-
include conf.d/scalelite/*;
49-
include conf.d/scalelite.common;
48+
include http.d/scalelite/*;
49+
include http.d/scalelite.common;
5050
}
File renamed without changes.

nginx/conf.d/scalelite.template renamed to nginx/http.d/scalelite.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ server {
2121
proxy_http_version 1.1;
2222
}
2323

24-
include conf.d/scalelite/*;
25-
include conf.d/scalelite.common;
24+
include http.d/scalelite/*;
25+
include http.d/scalelite.common;
2626
}

nginx/start

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ fi
1313
echo "Generating templated nginx configuration..."
1414
if [ "$NGINX_RECORDINGS_ONLY" = "true" ] ; then
1515
echo "Using nginx recordings only configuration template."
16-
nginx_template=/etc/nginx/conf.d/scalelite-recordings-only.template
16+
nginx_template=/etc/nginx/http.d/scalelite-recordings-only.template
1717
elif [ "$NGINX_BEHIND_PROXY" = "true" ] ; then
1818
echo "Using proxy configuration template."
19-
nginx_template=/etc/nginx/conf.d/scalelite-proxy.template
19+
nginx_template=/etc/nginx/http.d/scalelite-proxy.template
2020
elif [ "$NGINX_SSL" = "true" ] ; then
2121
echo "Using SSL configuration template."
22-
nginx_template=/etc/nginx/conf.d/scalelite-ssl.template
22+
nginx_template=/etc/nginx/http.d/scalelite-ssl.template
2323
else
2424
echo "Using non-SSL configuration template."
25-
nginx_template=/etc/nginx/conf.d/scalelite.template
25+
nginx_template=/etc/nginx/http.d/scalelite.template
2626
fi
2727

2828
# apply SCALELITE_API port from environment variable or use default port 3000
2929
SCALELITE_API_PORT=${SCALELITE_API_PORT:-3000}
3030
export SCALELITE_API_PORT
3131

32-
envsubst '$SCALELITE_API_PORT $URL_HOST' <$nginx_template >/etc/nginx/conf.d/scalelite.conf
32+
envsubst '$SCALELITE_API_PORT $URL_HOST' <$nginx_template >/etc/nginx/http.d/scalelite.conf
3333
unset nginx_template
3434

3535
mkdir -p /run/nginx

0 commit comments

Comments
 (0)