diff --git a/jenkins/docker/Dockerfile b/jenkins/docker/Dockerfile index e69de29..63e6dd4 100644 --- a/jenkins/docker/Dockerfile +++ b/jenkins/docker/Dockerfile @@ -0,0 +1,29 @@ +FROM jenkins:2.60.3 + +# Install docker +USER root +RUN apt-get update && apt-get install -y lsb-release +RUN curl -fsSLo /usr/share/keyrings/docker-archive-keyring.asc \ + https://download.docker.com/linux/debian/gpg +RUN echo "deb [arch=$(dpkg --print-architecture) \ + signed-by=/usr/share/keyrings/docker-archive-keyring.asc] \ + https://download.docker.com/linux/debian \ +$(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list +RUN apt-get update && apt-get install -y docker-ce-cli +ENV DOCKER_HOST=unix:///var/run/docker.sock + +# Give user `jenkins` permission to use the docker daemon. The group ID of the created `docker` +# group matches with the ID of the docker group on the MMKB core server +RUN groupadd --gid 999 docker +RUN usermod -aG docker jenkins + +# Import the CA Certificate needed for company GitLab into the JVM TrustStore to make it known to Jenkins +#COPY resources/SectigoRSADomainValidationSecureServerCA.pem /etc/ssl/certs/ +#RUN cd $JAVA_HOME/conf/security \ +# && keytool -cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias ucs-gitlab-cert -file /etc/ssl/certs/SectigoRSADomainValidationSecureServerCA.pem + +# create maven repository dir and grant permissions to jenkins user so that the directory is +# writeable for jenkins jobs +RUN mkdir -p /mvn/repository && chown jenkins:jenkins /mvn/repository + +USER jenkins diff --git a/jenkins/docker/script/docker.build.sh b/jenkins/docker/script/docker.build.sh new file mode 100644 index 0000000..cc2a286 --- /dev/null +++ b/jenkins/docker/script/docker.build.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +CURRENT_DIR=$(dirname "$0") +DOCKER_CONTEXT_DIR=$(readlink -f "$CURRENT_DIR/.."); + +tag="nexus.rschneider.hu/repo1/infra/jenkins:1.0.1" + +docker build --tag $tag . \ + && docker push $tag