THRIFT-5755 Docker image build fail
This PR submits fixes to the focal and jammy docker images.
* Bionic support was dropped becaused dotnet 8 no longer supports bionic
(Ubuntu 18.04). Moved to `old/` like other unmaintained images.
* Focal/Jammy used the wrong apt location for dotnet, endpoint was 18.04
instead of 20.04/22.04
* Jammy cannot build Erlang OPT 23 since it depends on OpenSSL 1.1
which was dropped in favor of 3.0. Using Erlang OPT 25 fixes the
problem since it depends on OpenSSL 3.0
* Jammy was installing JDK 11 but lib/java requires Java 17
All containers used the `root` used to volume map the local files into
the running container. This creates a hard to maintain working directory
on Linux and MacOS since files form the local user and root user are
mixed.
To solve this the new docker files can be build using the UID and GID of
the host so the files dont mix. The script uses UID and GID 1000 since
these are the default ids for most Linux distros.
Change the travis yml to build with 20.04 instead of 18.04. Removed all
traces of 18.04 but it cant be tested locally.
Updated the README to reflect the new `build/docker/` directory.
diff --git a/build/docker/ubuntu-focal/Dockerfile b/build/docker/ubuntu-focal/Dockerfile
index 416e806..00ab2be 100644
--- a/build/docker/ubuntu-focal/Dockerfile
+++ b/build/docker/ubuntu-focal/Dockerfile
@@ -39,7 +39,7 @@
# dotnet (netcore)
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
- wget -q -O /etc/apt/sources.list.d/microsoft-prod.list https://packages.microsoft.com/config/ubuntu/18.04/prod.list && \
+ wget -q -O /etc/apt/sources.list.d/microsoft-prod.list https://packages.microsoft.com/config/ubuntu/20.04/prod.list && \
chown root:root /etc/apt/trusted.gpg.d/microsoft.gpg && \
chown root:root /etc/apt/sources.list.d/microsoft-prod.list
@@ -280,7 +280,21 @@
# rm -rf /tmp/* && \
# rm -rf /var/tmp/*
+ARG user=build
+ARG group=build
+ARG uid=1000
+ARG gid=1000
+
+RUN apt-get install -y --no-install-recommends sudo && \
+ echo "Running with: UID: ${uid}, User: ${user}, GID: ${gid}, Group: ${group}" && \
+ if [ -z `cat /etc/group | grep "${group}:"` ]; then addgroup --gid ${gid} ${group}; fi && \
+ adduser --uid ${uid} --gid ${gid} --shell /bin/bash ${user} --disabled-password -q --gecos "" && \
+ echo "${user} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
+
ENV THRIFT_ROOT /thrift
-RUN mkdir -p $THRIFT_ROOT/src
+RUN mkdir -p $THRIFT_ROOT/src && \
+ chown -R ${uid}:${uid} $THRIFT_ROOT/
COPY Dockerfile $THRIFT_ROOT/
WORKDIR $THRIFT_ROOT/src
+
+USER ${user}