From af6d827a31f559ec13a22ae0e5b7e6c236ef1988 Mon Sep 17 00:00:00 2001 From: Jeff Alder Date: Thu, 22 Jul 2021 15:34:54 +0000 Subject: [PATCH 1/2] unixPB: Add alpine 3.14 container for docker host --- .../Dockerfiles/Dockerfile.alp314 | 32 +++++++++++++++++++ .../roles/DockerStatic/tasks/main.yml | 6 ++++ 2 files changed, 38 insertions(+) create mode 100644 ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp314 diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp314 b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp314 new file mode 100644 index 0000000000..182b94c1da --- /dev/null +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp314 @@ -0,0 +1,32 @@ +FROM alpine:3.14 + +# Install OpenJDK 8 from Alpine because AdoptOpenJDK is 16+, only (February, 2021). +RUN apk --update add bash shadow openssh-server openssh-client unzip wget openjdk8 git curl make gcc perl xvfb \ + libxrender libxi libxtst procps musl-dev perl-doc alsa-lib libx11 fontconfig libxext freetype zlib +RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -P "" + +# Install ant and ant-contrib. +RUN wget -O /tmp/ant.zip 'https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.9-bin.zip' +RUN wget -O /tmp/ant-contrib.tgz https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.tar.gz +RUN echo "d085f59349edf22a93d835aa30aea2521ed39bdb99d57d941f1ebd8d115a561bb28aecc781915ff2a0d9f7caf7bae536cdda0910bb432b2a4bce8b7b90c2903b /tmp/ant.zip" > /tmp/ant.sha512 +RUN echo "0fd2771dca2b8b014a4cb3246715b32e20ad5d26754186d82eee781507a183d5e63064890b95eb27c091c93c1209528a0b18a6d7e6901899319492a7610e74ad /tmp/ant-contrib.tgz" >> /tmp/ant.sha512 +RUN sha512sum --check --strict /tmp/ant.sha512 +RUN unzip -q -d /usr/local /tmp/ant.zip +RUN tar xpfz /tmp/ant-contrib.tgz -C /usr/local/apache-ant-1.10.9/lib --strip-components=2 ant-contrib/lib/ant-contrib.jar +RUN ln -s /usr/local/apache-ant-1.10.9/bin/ant /usr/bin/ant + +# Create user jenkins with random password. Prevents locked user account that makes SSH'ing into +# the container impossible. +RUN groupadd -g 10001 jenkins +RUN useradd -p $(tr -dc A-Za-z0-9 /home/jenkins/.ssh/authorized_keys +RUN chown -R jenkins:jenkins /home/jenkins/.ssh +RUN chmod -R "g=,o=" /home/jenkins/.ssh + +# Remove temporary files. +RUN rm -rf /tmp/ant* /tmp/ant-contrib* + +# Start container with docker run -p 2222:22 UUID. +CMD ["/usr/sbin/sshd","-D"] +EXPOSE 22 diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/tasks/main.yml index 764f568e1f..57d837b571 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/tasks/main.yml @@ -36,6 +36,7 @@ - alp311 - alp312 - alp313 + - alp314 ############################################################## # Start the containers # @@ -87,6 +88,11 @@ tags: startcontainers ignore_errors: yes +- name: Start Alpine 3.14 container if not already started + command: docker run --restart unless-stopped -p 2231:22 --cpus=2.0 --memory=6G --detach --name alp314.2231 aqa_alp314 + tags: startcontainers + ignore_errors: yes + # lineinfile does not work here - similar to the operation in /var/log in adopt_etc # lineinfile: path /proc/sys/kernel/core_pattern state: present: regexp: . line: core.%p From 096b3bc78b928ed8041ca1d1fdc35b7fbf6e91aa Mon Sep 17 00:00:00 2001 From: Jeff Alder Date: Tue, 7 Sep 2021 15:50:59 +0000 Subject: [PATCH 2/2] Alpine only support short-form parameters --- .../roles/DockerStatic/Dockerfiles/Dockerfile.alp314 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp314 b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp314 index 182b94c1da..d7f74180c5 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp314 +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp314 @@ -10,7 +10,7 @@ RUN wget -O /tmp/ant.zip 'https://archive.apache.org/dist/ant/binaries/apache-an RUN wget -O /tmp/ant-contrib.tgz https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.tar.gz RUN echo "d085f59349edf22a93d835aa30aea2521ed39bdb99d57d941f1ebd8d115a561bb28aecc781915ff2a0d9f7caf7bae536cdda0910bb432b2a4bce8b7b90c2903b /tmp/ant.zip" > /tmp/ant.sha512 RUN echo "0fd2771dca2b8b014a4cb3246715b32e20ad5d26754186d82eee781507a183d5e63064890b95eb27c091c93c1209528a0b18a6d7e6901899319492a7610e74ad /tmp/ant-contrib.tgz" >> /tmp/ant.sha512 -RUN sha512sum --check --strict /tmp/ant.sha512 +RUN sha512sum -c /tmp/ant.sha512 RUN unzip -q -d /usr/local /tmp/ant.zip RUN tar xpfz /tmp/ant-contrib.tgz -C /usr/local/apache-ant-1.10.9/lib --strip-components=2 ant-contrib/lib/ant-contrib.jar RUN ln -s /usr/local/apache-ant-1.10.9/bin/ant /usr/bin/ant