summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorLukas Larsson <lukas@erlang.org>2022-10-12 16:44:38 +0200
committerLukas Larsson <lukas@erlang.org>2022-10-18 09:01:32 +0200
commit6da37b33808edc719f110ec237ad4b93d942817c (patch)
treebd8cd613909e0dc65806aaba34e8a84a5cba62a8 /.github
parent29b6a6634ff9503db8fc20ff1f5231000ea5bb6c (diff)
downloaderlang-6da37b33808edc719f110ec237ad4b93d942817c.tar.gz
gh: Refactor docker images build 3pp's in base
Diffstat (limited to '.github')
-rw-r--r--.github/dockerfiles/Dockerfile.64-bit18
-rw-r--r--.github/dockerfiles/Dockerfile.ubuntu-base77
2 files changed, 46 insertions, 49 deletions
diff --git a/.github/dockerfiles/Dockerfile.64-bit b/.github/dockerfiles/Dockerfile.64-bit
index 2f5a5b3a93..6655eac968 100644
--- a/.github/dockerfiles/Dockerfile.64-bit
+++ b/.github/dockerfiles/Dockerfile.64-bit
@@ -23,24 +23,6 @@ RUN ./configure --prefix="/Erlang ∅⊤℞" && \
## Disable -Werror as testcases do not compile with it on
ENV CFLAGS="-O2 -g"
-WORKDIR /buildroot/
-
-## Install test tools rebar3, proper and jsx
-RUN latest () { \
- local VSN=$(curl -sL "https://api.github.com/repos/$1/tags" | jq -r ".[] | .name" | grep -E '^v?[0-9]' | sort -V | tail -1); \
- curl -sL "https://github.com/$1/archive/$VSN.tar.gz" > $(basename $1).tar.gz; \
- } && \
- latest erlang/rebar3 && ls -la && \
- (tar xzf rebar3.tar.gz && cd rebar3-* && ./bootstrap && sudo cp rebar3 /usr/bin) && \
- latest proper-testing/proper && \
- (tar xzf proper.tar.gz && mv proper-* proper && cd proper && make) && \
- latest talentdeficit/jsx && \
- (tar xzf jsx.tar.gz && mv jsx-* jsx && cd jsx && rebar3 compile)
-
-ENV ERL_LIBS=/buildroot/proper:/buildroot/jsx
-
-WORKDIR /buildroot/otp/
-
## Update init.sh with correct env vars
RUN echo "export MAKEFLAGS=$MAKEFLAGS" > /buildroot/env.sh && \
echo "export ERLC_USE_SERVER=$ERLC_USE_SERVER" >> /buildroot/env.sh && \
diff --git a/.github/dockerfiles/Dockerfile.ubuntu-base b/.github/dockerfiles/Dockerfile.ubuntu-base
index e2b5f9ee76..4457d62a1f 100644
--- a/.github/dockerfiles/Dockerfile.ubuntu-base
+++ b/.github/dockerfiles/Dockerfile.ubuntu-base
@@ -6,8 +6,6 @@ FROM $BASE
ENV INSTALL_LIBS="zlib1g-dev libncurses5-dev libssl-dev unixodbc-dev libsctp-dev lksctp-tools libgmp3-dev libwxbase3.0-dev libwxgtk3.0-gtk3-dev libwxgtk-webview3.0-gtk3-dev"
-ARG EXTRA_LIBS="erlang erlang-doc"
-
USER root
ENV DEBIAN_FRONTEND=noninteractive
@@ -16,17 +14,37 @@ ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
## Install build tools
RUN apt-get update && apt-get -y upgrade && \
apt-get install -y build-essential m4 autoconf fop xsltproc \
- default-jdk libxml2-utils flex pkg-config locales tzdata ${INSTALL_LIBS} && \
+ default-jdk libxml2-utils flex pkg-config locales tzdata sudo ${INSTALL_LIBS} && \
sed -i 's@# en_US.UTF-8@en_US.UTF-8@g' /etc/locale.gen && locale-gen && \
update-alternatives --set wx-config /usr/lib/x86_64-linux-gnu/wx/config/gtk3-unicode-3.0
-## EXTRA_LIBS are installed using a for loop because of bugs in the erlang-doc deb package
-## Apache2 may already be installed, if so we do not want to install it again
-
ARG MAKEFLAGS=-j4
ENV MAKEFLAGS=$MAKEFLAGS \
ERLC_USE_SERVER=yes
+ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
+
+ARG USER=gitpod
+ARG GROUP=gitpod
+ARG gid=10
+ARG uid=421
+
+RUN echo "Europe/Stockholm" > /etc/timezone && \
+ ln -snf /usr/share/zoneinfo/$(cat /etc/timezone) /etc/localtime && \
+ if ! grep ":${gid}:$" /etc/group; then groupadd -g ${gid} localgroup; fi && \
+ if [ ! -d /home/${USER} ]; then useradd -rm -d /home/${USER} -s /bin/sh -g ${gid} -G ${gid},sudo -u ${uid} ${USER}; fi && \
+ echo "${USER} ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/${USER} && \
+ echo "/buildroot/** r," >> /etc/apparmor.d/local/usr.sbin.named && \
+ echo "/tests/** r," >> /etc/apparmor.d/local/usr.sbin.named
+
+## Java and log4j are used by fop to build documentation
+COPY --chown=${USER}:${GROUP} dockerfiles/log4j.properties /home/${USER}/
+ENV JAVA_ARGS="-Dlog4j.configuration=file://home/${USER}/log4j.properties"
+
+ENV OTP_STRICT_INSTALL=yes
+
+RUN mkdir /buildroot /tests /otp && chown ${USER}:${GROUP} /buildroot /tests /otp
+
## We install the latest version of the previous three releases in order to do
## backwards compatability testing of Erlang.
RUN apt-get install -y git curl && \
@@ -34,7 +52,8 @@ RUN apt-get install -y git curl && \
chmod +x /usr/bin/kerl && \
kerl update releases && \
LATEST=$(kerl list releases | tail -1 | awk -F '.' '{print $1}') && \
- for release in $(seq $(( LATEST - 3 )) $(( LATEST - 1 ))); do \
+ echo "/usr/local/lib/erlang-${LATEST}/bin" > /home/${USER}/LATEST && \
+ for release in $(seq $(( LATEST - 2 )) $(( LATEST ))); do \
VSN=$(kerl list releases | grep "^$release" | tail -1); \
kerl build ${VSN} ${VSN} && \
kerl install ${VSN} /usr/local/lib/erlang-${VSN}; \
@@ -42,8 +61,11 @@ RUN apt-get install -y git curl && \
rm -rf ~/.kerl
## Install test tools
+## EXTRA_LIBS are installed using a for loop because of bugs in the erlang-doc deb package
+## Apache2 may already be installed, if so we do not want to install it again
+ARG EXTRA_LIBS="erlang erlang-doc"
RUN apt-get install -y \
- unixodbc odbc-postgresql postgresql ssh openssh-server groff-base sudo gdb \
+ unixodbc odbc-postgresql postgresql ssh openssh-server groff-base gdb \
tinyproxy bind9 nsd expect vsftpd python emacs nano vim \
linux-tools-common linux-tools-generic linux-tools-`uname -r` jq \
xvfb libgl1-mesa-dri && \
@@ -57,21 +79,6 @@ RUN apt-get install -y libevent-dev libutf8proc-dev && \
./configure --enable-static --enable-utf8proc && \
make && make install
-ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
-
-ARG USER=gitpod
-ARG GROUP=gitpod
-ARG gid=10
-ARG uid=421
-
-RUN echo "Europe/Stockholm" > /etc/timezone && \
- ln -snf /usr/share/zoneinfo/$(cat /etc/timezone) /etc/localtime && \
- if ! grep ":${gid}:$" /etc/group; then groupadd -g ${gid} localgroup; fi && \
- if [ ! -d /home/${USER} ]; then useradd -rm -d /home/${USER} -s /bin/sh -g ${gid} -G ${gid},sudo -u ${uid} ${USER}; fi && \
- echo "${USER} ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/${USER} && \
- echo "/buildroot/** r," >> /etc/apparmor.d/local/usr.sbin.named && \
- echo "/tests/** r," >> /etc/apparmor.d/local/usr.sbin.named
-
## Setup progres so that the odbc test can run
USER postgres
@@ -90,15 +97,23 @@ ENV USER=${USER}
RUN ssh-keygen -q -t rsa -N '' -f $HOME/.ssh/id_rsa && \
cp $HOME/.ssh/id_rsa.pub $HOME/.ssh/authorized_keys
-## Java and log4j are used by fop to build documentation
-COPY --chown=${USER}:${GROUP} dockerfiles/log4j.properties /home/${USER}/
-ENV OTP_STRICT_INSTALL=yes \
- JAVA_ARGS="-Dlog4j.configuration=file://home/${USER}/log4j.properties"
-
-RUN sudo mkdir /buildroot /tests /otp && sudo chown ${USER}:${GROUP} /buildroot /tests /otp
-
COPY --chown=${USER}:${GROUP} dockerfiles/init.sh /buildroot/
-## TODO: Build Erlang versions N, N-1 and N-2 for compatability testing.
+WORKDIR /buildroot/
+
+## Install test tools rebar3, proper and jsx
+RUN export PATH="$(cat /home/${USER}/LATEST)/${PATH}" && \
+ latest () { \
+ local VSN=$(curl -sL "https://api.github.com/repos/$1/tags" | jq -r ".[] | .name" | grep -E '^v?[0-9]' | sort -V | tail -1); \
+ curl -sL "https://github.com/$1/archive/$VSN.tar.gz" > $(basename $1).tar.gz; \
+ } && \
+ latest erlang/rebar3 && ls -la && \
+ (tar xzf rebar3.tar.gz && cd rebar3-* && ./bootstrap && sudo cp rebar3 /usr/bin) && \
+ latest proper-testing/proper && \
+ (tar xzf proper.tar.gz && mv proper-* proper && cd proper && make) && \
+ latest talentdeficit/jsx && \
+ (tar xzf jsx.tar.gz && mv jsx-* jsx && cd jsx && rebar3 compile)
+
+ENV ERL_LIBS=/buildroot/proper:/buildroot/jsx
ENTRYPOINT ["/buildroot/init.sh"]