initial commit with apps from course repo
This commit is contained in:
70
nexus-image/Dockerfile
Normal file
70
nexus-image/Dockerfile
Normal file
@@ -0,0 +1,70 @@
|
||||
FROM rhel7:7.6
|
||||
|
||||
MAINTAINER Red Hat Training
|
||||
|
||||
ARG NEXUS_VERSION=2.14.3-02
|
||||
ARG NEXUS_DOWNLOAD_URL=http://content.example.com/ocp3.6/x86_64/installers/nexus-${NEXUS_VERSION}-bundle.tar.gz
|
||||
|
||||
ENV SONATYPE_WORK=/sonatype-work \
|
||||
USER_NAME=nexus \
|
||||
USER_UID=200
|
||||
|
||||
|
||||
ADD usr/local/bin/fix-permissions.sh /usr/local/bin/fix-permissions.sh
|
||||
ADD probes/liveness.sh /usr/local/bin/liveness.sh
|
||||
ADD probes/readiness.sh /usr/local/bin/readiness.sh
|
||||
ADD uid_entrypoint /
|
||||
|
||||
#install tools and Java
|
||||
RUN rpm --rebuilddb && \
|
||||
yum install -y \
|
||||
curl tar createrepo java-1.8.0-openjdk-devel \
|
||||
&& yum clean all \
|
||||
#install nexus
|
||||
&& mkdir -p /opt/sonatype/nexus \
|
||||
&& mkdir ${SONATYPE_WORK} \
|
||||
&& curl --fail --silent --location --retry 3 \
|
||||
${NEXUS_DOWNLOAD_URL} \
|
||||
| gunzip \
|
||||
| tar x -C /tmp nexus-${NEXUS_VERSION} \
|
||||
&& mv /tmp/nexus-${NEXUS_VERSION}/* /opt/sonatype/nexus/ \
|
||||
&& rm -rf /tmp/nexus-${NEXUS_VERSION} \
|
||||
#create a user for nexus
|
||||
&& useradd -r -u 200 -m -c "nexus role account" -s /bin/false nexus \
|
||||
#fix permissions
|
||||
&& chmod 755 /usr/local/bin/fix-permissions.sh \
|
||||
&& chmod 755 /usr/local/bin/liveness.sh \
|
||||
&& chmod 755 /usr/local/bin/readiness.sh \
|
||||
&& chmod ug+x /uid_entrypoint \
|
||||
&& chmod g+rw /etc/passwd \
|
||||
&& /usr/local/bin/fix-permissions.sh /opt/sonatype \
|
||||
&& /usr/local/bin/fix-permissions.sh ${SONATYPE_WORK}
|
||||
|
||||
|
||||
# arbitrary uid recognition at runtime - for OpenShift deployments
|
||||
RUN sed "s@${USER_NAME}:x:${USER_UID}:@${USER_NAME}:x:\${USER_ID}:@g" /etc/passwd > /etc/passwd.template
|
||||
|
||||
#Expose the nexus port
|
||||
EXPOSE 8081
|
||||
|
||||
#Configure the workdir
|
||||
WORKDIR /opt/sonatype/nexus
|
||||
|
||||
USER nexus
|
||||
|
||||
ENV CONTEXT_PATH /nexus \
|
||||
MAX_HEAP 768m \
|
||||
MIN_HEAP 256m \
|
||||
JAVA_OPTS -server -Djava.net.preferIPv4Stack=true \
|
||||
LAUNCHER_CONF ./conf/jetty.xml ./conf/jetty-requestlog.xml
|
||||
|
||||
|
||||
ENTRYPOINT [ "/uid_entrypoint" ]
|
||||
|
||||
CMD java \
|
||||
-Dnexus-work=${SONATYPE_WORK} -Dnexus-webapp-context-path=${CONTEXT_PATH} \
|
||||
-Xms${MIN_HEAP} -Xmx${MAX_HEAP} \
|
||||
-cp 'conf/:lib/*' \
|
||||
${JAVA_OPTS} \
|
||||
org.sonatype.nexus.bootstrap.Launcher ${LAUNCHER_CONF}
|
||||
|
||||
54
nexus-image/etc/training.repo
Normal file
54
nexus-image/etc/training.repo
Normal file
@@ -0,0 +1,54 @@
|
||||
[rhel-7-dvd]
|
||||
baseurl = http://content.example.com/rhel7.6/x86_64/dvd
|
||||
enabled = true
|
||||
gpgcheck = false
|
||||
name = Remote classroom copy of RHEL DVD
|
||||
|
||||
[rhel-server-rhscl-7-rpms]
|
||||
baseurl = http://content.example.com/ocp4.0/x86_64/rhelrhscl
|
||||
enabled = true
|
||||
gpgcheck = false
|
||||
name = Remote classroom copy of RHSCL
|
||||
|
||||
[rhel-7-server-datapath-rpms]
|
||||
baseurl = http://content.example.com/ocp4.0/x86_64/rheladditional/rhel-7-fast-datapath-rpms
|
||||
enabled = true
|
||||
gpgcheck = false
|
||||
name = Remote classroom copy of RHEL 7.6 Datapath Packages
|
||||
|
||||
[rhel-7-server-ansible-26]
|
||||
baseurl = http://content.example.com/ocp4.0/x86_64/rheladditional/rhel-7-server-ansible-2.6-rpms
|
||||
enabled = true
|
||||
gpgcheck = false
|
||||
name = Remote classroom copy of RHEL 7.6 Ansible Packages
|
||||
|
||||
[rhel-7-server-extras-rpms]
|
||||
baseurl = http://content.example.com/ocp4.0/x86_64/rheladditional/rhel-7-server-extras-rpms
|
||||
enabled = true
|
||||
gpgcheck = false
|
||||
name = Remote classroom copy of RHEL 7.6 Extra Packages
|
||||
|
||||
[rhel-7-server-common-rpms]
|
||||
baseurl = http://content.example.com/ocp4.0/x86_64/rheladditional/rhel-7-server-rh-common-rpms
|
||||
enabled = true
|
||||
gpgcheck = false
|
||||
name = Remote classroom copy of RHEL 7.6 Common Packages
|
||||
|
||||
[rhel-7-server-supplementary]
|
||||
baseurl = http://content.example.com/ocp4.0/x86_64/rhelsupplementary
|
||||
enabled = true
|
||||
gpgcheck = false
|
||||
name = Remote classroom copy of RHEL 7.6 Supplementary Packages
|
||||
|
||||
[rhel-7-server-optional-rpms]
|
||||
baseurl = http://content.example.com/ocp4.0/x86_64/rhelopt
|
||||
enabled = true
|
||||
gpgcheck = false
|
||||
name = Remote classroom copy of RHEL 7.6 Optional Packages
|
||||
|
||||
[rhel-7-server-updates]
|
||||
baseurl = http://content.example.com/ocp4.0/x86_64/rhelupdates
|
||||
enabled = true
|
||||
gpgcheck = false
|
||||
name = Remote classroom copy of RHEL 7.6 Updates
|
||||
|
||||
13
nexus-image/probes/liveness.sh
Normal file
13
nexus-image/probes/liveness.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
curl -si localhost:8081/nexus/service/local/repositories | grep Central
|
||||
RESPONSE=$?
|
||||
|
||||
if [ "$RESPONSE" = "0" ] ; then
|
||||
echo "******** liveness is Alive ********"
|
||||
exit 0;
|
||||
else
|
||||
echo "******** liveness is Dead ********"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
13
nexus-image/probes/readiness.sh
Normal file
13
nexus-image/probes/readiness.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
curl -si localhost:8081/nexus/service/local/repositories | grep Central
|
||||
RESPONSE=$?
|
||||
|
||||
if [ "$RESPONSE" = "0" ] ; then
|
||||
echo "******** readiness is Alive ********"
|
||||
exit 0;
|
||||
else
|
||||
echo "******** readiness is Dead ********"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
6
nexus-image/uid_entrypoint
Normal file
6
nexus-image/uid_entrypoint
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
USER_ID=$(id -u)
|
||||
if [ ${USER_UID} != ${USER_ID} ]; then
|
||||
sed "s@${USER_NAME}:x:\${USER_ID}:@${USER_NAME}:x:${USER_ID}:@g" /etc/passwd.template > /etc/passwd
|
||||
fi
|
||||
exec "$@"
|
||||
5
nexus-image/usr/local/bin/fix-permissions.sh
Normal file
5
nexus-image/usr/local/bin/fix-permissions.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
chgrp -R 0 $1
|
||||
chmod -R g+rwx $1
|
||||
Reference in New Issue
Block a user