Dan K
2019-08-04 ac6169db7b90e950156a87d9784308429ce3bee2
commit | author | age
ac6169 1 # Copyright (c) 2016-present Sonatype, Inc.
DK 2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 FROM       registry.access.redhat.com/rhel7:7.6
16 MAINTAINER Red Hat Training
17
18
19 # Atomic Labels
20 LABEL name="Nexus Repository Manager" \
21       vendor="Sonatype" \
22       version="3.6.0-02" \
23       release="3.6.0" \
24       url="https://sonatype.com" \
25       summary="The Nexus Repository Manager server \
26           with universal support for popular component formats." \
27       run="docker run -d --name NAME \
28           -p 8081:8081 \
29           IMAGE" \
30       stop="docker stop NAME"
31
32 # OpenShift Labels
33 LABEL io.k8s.description="The Nexus Repository Manager server \
34           with universal support for popular component formats." \
35       io.k8s.display-name="Nexus Repository Manager" \
36       io.openshift.expose-services="8081:8081" \
37 io.openshift.tags="Sonatype,Nexus,Repository Manager"
38
39 LABEL com.sonatype.license="Apache License, Version 2.0"
40
41 COPY help.1 uid_entrypoint /
42
43 COPY licenses /licenses
44
45
46 RUN rpm --rebuilddb && \
47   yum install -y \
48   curl tar createrepo java-1.8.0-openjdk-devel \
49   && yum clean all
50
51
52 # Install Nexus
53 ENV SONATYPE_DIR=/opt/sonatype
54 ENV NEXUS_DATA=/nexus-data \
55     NEXUS_HOME=${SONATYPE_DIR}/nexus \
56     NEXUS_VERSION=3.6.0-02 \
57     SONATYPE_WORK=${SONATYPE_DIR}/sonatype-work \
58     NEXUS_CONTEXT='' \
59     USER_NAME=nexus \
60     USER_UID=200
61
62 # Install Nexus and Configure Nexus Runtime Environment
63 RUN mkdir -p ${NEXUS_HOME} && \
64     curl --fail --silent --location --retry 3 \
65       http://content.example.com/ocp3.6/x86_64/installers/nexus-${NEXUS_VERSION}-unix.tar.gz \
66       | gunzip \
67       | tar x -C ${NEXUS_HOME} --strip-components=1 nexus-${NEXUS_VERSION} && \
68     chown -R root:root ${NEXUS_HOME} && \
69     \
70     sed \
71       -e '/^nexus-context/ s:$:${NEXUS_CONTEXT}:' \
72       -i ${NEXUS_HOME}/etc/nexus-default.properties && \
73     \
74     useradd -l -u ${USER_UID} -r -g 0 -m -d ${NEXUS_DATA} -s /sbin/no-login \
75             -c "${USER_NAME} application user" ${USER_NAME} && \
76             mkdir -p ${NEXUS_DATA}/etc ${NEXUS_DATA}/log ${NEXUS_DATA}/tmp ${SONATYPE_WORK} && \
77             ln -s ${NEXUS_DATA} ${SONATYPE_WORK}/nexus3 && \
78             chown -R ${USER_NAME}:0 ${NEXUS_DATA} && \
79             chmod -R g+rw ${NEXUS_DATA} /etc/passwd && \
80             chmod ug+x /uid_entrypoint && \
81             find ${NEXUS_DATA} -type d -exec chmod g+x {} +
82
83 VOLUME ${NEXUS_DATA}
84
85 #Configure probes scripts
86 COPY probes/liveness.sh /usr/local/bin/liveness.sh
87 COPY probes/readiness.sh /usr/local/bin/readiness.sh
88
89 RUN chmod 775 /usr/local/bin/liveness.sh && \
90     chmod 775 /usr/local/bin/readiness.sh
91
92 # arbitrary uid recognition at runtime - for OpenShift deployments
93 RUN sed "s@${USER_NAME}:x:${USER_UID}:@${USER_NAME}:x:\${USER_ID}:@g" /etc/passwd > /etc/passwd.template
94
95 # Supply non variable to USER command ${USER_NAME}
96 USER 200
97 WORKDIR ${NEXUS_HOME}
98
99 ENV JAVA_MAX_MEM=1200m \
100     JAVA_MIN_MEM=1200m
101
102 EXPOSE 8081
103
104 ENTRYPOINT [ "/uid_entrypoint" ]
105 CMD ["bin/nexus", "run"]
106