Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
# ---------------------------------------------------------------------------
# See the NOTICE file distributed with this work for additional
# information regarding copyright ownership.
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this software; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
# ---------------------------------------------------------------------------
# TODO: Upgrade to jenkins/ssh-agent:jdk11 since jenkins/ssh-slave is deprecated
FROM jenkins/ssh-slave:jdk11
# ____ ____ ____ ____ _ __ _
# |_ _||_ _||_ _| |_ _|(_) [ | _ (_)
# \ \ / / \ \ /\ / / __ | | / ] __
# > `' < \ \/ \/ / [ | | '' < [ |
# _/ /'`\ \_ \ /\ / | | | |`\ \ | |
# |____||____| \/ \/ [___][__| \_][___]
LABEL maintainer="XWiki Development Team <committers@xwiki.org>"
# Note: The base image already installs Java 11. So we don't need to install it again.
# Install:
# - VNC
# - Docker CE
# - lsof, to list open ports for debugging reasons
# - netstats (through net-tools), for debugging reasons
# - bc needed by some building scripts (e.g. CKEditor)
# - other tools needed by the Dockerfile (such as zip, etc)
RUN apt-get update && \
apt-get --no-install-recommends -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
zip \
lsof \
software-properties-common \
net-tools \
bc
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
# Note: We must install the same version of Docker that is installed on the CI agents since we share the same docker
# socket (docker on docker) and we want to reduce likelihood of issues.
RUN apt-get update && \
apt-get --no-install-recommends -y install \
xfce4 xfce4-goodies xfonts-base tightvncserver docker-ce=5:20.10.8~3-0~debian-buster
# Install Firefox.
# Note 1: This won't be needed when we'll have all our functional tests use docker. However, as a transitional step,
# we should provide it, so that all agents can use this image to build XWiki fully.
# Note 2: The FF version we install is the version of the selenium/standalone-firefox-debug image used by TestContainers
# See https://dev.xwiki.org/xwiki/bin/view/Community/Testing/DockerTesting/#HFirefoxVersionUsed
# Note 3: We also install FF 32.0.1 for older branches still using Selenium 2.x
ENV FIREFOX_VERSION_1 101.0.1
ENV FIREFOX_DOWNLOAD_URL_1="https://download-installer.cdn.mozilla.net/pub/firefox/releases/$FIREFOX_VERSION_1/linux-x86_64/en-US/firefox-$FIREFOX_VERSION_1.tar.bz2"
ENV FIREFOX_VERSION_2 32.0.1
ENV FIREFOX_DOWNLOAD_URL_2="https://download-installer.cdn.mozilla.net/pub/firefox/releases/$FIREFOX_VERSION_2/linux-x86_64/en-US/firefox-$FIREFOX_VERSION_2.tar.bz2"
RUN apt-get --no-install-recommends -y install libasound2 && \
wget --no-verbose -O /tmp/firefox1.tar.bz2 $FIREFOX_DOWNLOAD_URL_1 && \
rm -rf /opt/firefox && \
tar -C /opt -xjf /tmp/firefox1.tar.bz2 && \
rm /tmp/firefox1.tar.bz2 && \
mv /opt/firefox /opt/firefox-$FIREFOX_VERSION_1 && \
ln -fs /opt/firefox-$FIREFOX_VERSION_1/firefox /usr/bin/firefox && \
wget --no-verbose -O /tmp/firefox2.tar.bz2 $FIREFOX_DOWNLOAD_URL_2 && \
tar -C /opt -xjf /tmp/firefox2.tar.bz2 && \
rm /tmp/firefox2.tar.bz2 && \
mv /opt/firefox /opt/firefox-$FIREFOX_VERSION_2 && \
ln -fs /opt/firefox-$FIREFOX_VERSION_2 /usr/bin/firefox-$FIREFOX_VERSION_2
WORKDIR /root
# Add Zulu repository to install Java7
# Instructions from https://docs.azul.com/zulu/zuludocs/#ZuluUserGuide/PrepareZuluPlatform/AttachAPTRepositoryUbuntuOrDebianSys.htm
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
RUN echo 'deb http://repos.azulsystems.com/debian stable main' > /etc/apt/sources.list.d/zulu.list
RUN apt-get update && \
apt-get --no-install-recommends -y install zulu-7
# Install Java 8
# TODO: Remove once we support Java 17 fully
RUN wget --no-verbose -O /usr/lib/jvm/java8.tar.gz https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u312-b07/OpenJDK8U-jdk_x64_linux_hotspot_8u312b07.tar.gz && \
tar -C /usr/lib/jvm -xzf /usr/lib/jvm/java8.tar.gz && \
rm /usr/lib/jvm/java8.tar.gz
# Install Java 14. We need this because:
# - For Sonar, we need a JVM >= 11
# - We should be using Java 17 (LTS and supposed to be supported by XWiki) but right now we cannot run XWiki's build on
# Java 16 or 17 because of Spoon (see https://github.com/INRIA/spoon/issues/4251).
# Thus we use the next best java version which is Java 14.
# TODO: Remove this when XWiki builds with Java 17.
RUN wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add - && \
add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ && \
apt-get update && \
apt-get --yes install adoptopenjdk-14-hotspot
# Install Java 17
RUN wget --no-verbose -O /usr/lib/jvm/java17.tar.gz https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.1%2B12/OpenJDK17U-jdk_x64_linux_hotspot_17.0.1_12.tar.gz && \
tar -C /usr/lib/jvm -xzf /usr/lib/jvm/java17.tar.gz && \
rm /usr/lib/jvm/java17.tar.gz
# Copy VNC config files
COPY vnc/.Xauthority .Xauthority
COPY vnc/.vnc .vnc
# Generate a password for XVNC
RUN echo "jenkins" | vncpasswd -f > .vnc/passwd
# This is important as otherwise vncserver requires a password when started
RUN chmod 0600 .vnc/passwd
# Install the latest Maven version supported by the XWiki build, so that developers can benefit from the Gradle
# Enterprise remote cache (https://ge.xwiki.org), as it'll only be triggered if the Maven version is the same on the
# CI and locally (note: bugfix versions are not taken into account).
ENV MAVEN_VERSION 3.8.3
RUN wget https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz && \
tar -xvzf apache-maven-$MAVEN_VERSION-bin.tar.gz && \
rm apache-maven-$MAVEN_VERSION-bin.tar.gz
# ci.xwiki.org expects:
# - Java17 to be available at /home/hudsonagent/java17
# - Java14 to be available at /home/hudsonagent/java14
# - Java11 to be available at /home/hudsonagent/java11
# - Java8 to be available at /home/hudsonagent/java8
# - Java7 to be available at /home/hudsonagent/java7
# - Maven to be available at /home/hudsonagent/maven
# - Default java to be Java 11
# - "mvn" to be on the path
RUN mkdir -p /home/hudsonagent && \
ln -fs $JAVA_HOME /home/hudsonagent/java11 && \
ln -fs /usr/lib/jvm/jdk-17.0.1+12 /home/hudsonagent/java17 && \
ln -fs /usr/lib/jvm/adoptopenjdk-14-hotspot-amd64 /home/hudsonagent/java14 && \
ln -fs /usr/lib/jvm/jdk8u312-b07 /home/hudsonagent/java8 && \
ln -fs /usr/lib/jvm/zulu-7-amd64 /home/hudsonagent/java7 && \
ln -fs /home/hudsonagent/java11 /home/hudsonagent/java && \
ln -fs /home/hudsonagent/java/bin/java /usr/bin/java && \
ln -fs /root/apache-maven-$MAVEN_VERSION /home/hudsonagent/maven && \
# Use /etc/profile.d so that Maven is in all paths for all shells (sh, bash, etc), when using login, for example
# with "docker exec -it ... bash -l".
echo 'export M2_HOME=/home/hudsonagent/maven' > /etc/profile.d/xwiki.sh && \
echo 'export PATH=$M2_HOME/bin:$PATH' >> /etc/profile.d/xwiki.sh
# Needed so that invocation through "docker run ... --entrypoint "/bin/sh" or "/bin/bash" work fine (i.e without login)
ENV PATH="/home/hudsonagent/maven/bin:${PATH}"
# Set up the default Maven repository configuration (settings.xml)
RUN mkdir -p /root/.m2
COPY maven/settings.xml /root/.m2/settings.xml
# Set locales
RUN apt-get --no-install-recommends -y install locales && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV USER root
ENV JAVA_HOME /home/hudsonagent/java
# Environment variable needed to have phantomJS working in our Jasmine tests.
ENV OPENSSL_CONF "/etc/ssl"
COPY ssh/setup-xwiki-ssh /usr/local/bin/setup-xwiki-ssh
RUN chmod a+x /usr/local/bin/setup-xwiki-ssh
ENTRYPOINT ["setup-xwiki-ssh"]