Skip to content

Commit

Permalink
NEXUS-11119 - Nexus 3.1 and required layout changes (sonatype#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbradicich authored Nov 1, 2016
1 parent 3c7173f commit abac465
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,19 @@ RUN yum install -y \
curl tar \
&& yum clean all

# install Oracle JRE
# configure java runtime
ENV JAVA_HOME=/opt/java \
JAVA_VERSION_MAJOR=8 \
JAVA_VERSION_MINOR=102 \
JAVA_VERSION_BUILD=14

# configure nexus runtime
ENV NEXUS_VERSION=3.1.0-04 \
NEXUS_HOME=/opt/sonatype/nexus \
NEXUS_DATA=/nexus-data \
NEXUS_CONTEXT=''

# install Oracle JRE
RUN mkdir -p /opt \
&& curl --fail --silent --location --retry 3 \
--header "Cookie: oraclelicense=accept-securebackup-cookie; " \
Expand All @@ -39,36 +46,36 @@ RUN mkdir -p /opt \
&& ln -s /opt/jdk1.${JAVA_VERSION_MAJOR}.0_${JAVA_VERSION_MINOR} ${JAVA_HOME}

# install nexus
ENV NEXUS_VERSION=3.0.2-02
RUN mkdir -p /opt/sonatype/nexus \
RUN mkdir -p ${NEXUS_HOME} \
&& curl --fail --silent --location --retry 3 \
https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz \
| gunzip \
| tar x -C /opt/sonatype/nexus --strip-components=1 nexus-${NEXUS_VERSION} \
&& chown -R root:root /opt/sonatype/nexus
| tar x -C ${NEXUS_HOME} --strip-components=1 nexus-${NEXUS_VERSION} \
&& chown -R root:root ${NEXUS_HOME}

## configure nexus runtime env
ENV NEXUS_CONTEXT='' \
NEXUS_DATA=/nexus-data
# configure nexus
RUN sed \
-e "s|karaf.home=.|karaf.home=/opt/sonatype/nexus|g" \
-e "s|karaf.base=.|karaf.base=/opt/sonatype/nexus|g" \
-e "s|karaf.etc=etc|karaf.etc=/opt/sonatype/nexus/etc|g" \
-e "s|java.util.logging.config.file=etc|java.util.logging.config.file=/opt/sonatype/nexus/etc|g" \
-e "s|karaf.data=data|karaf.data=${NEXUS_DATA}|g" \
-e "s|java.io.tmpdir=data/tmp|java.io.tmpdir=${NEXUS_DATA}/tmp|g" \
-i /opt/sonatype/nexus/bin/nexus.vmoptions \
-e "s|karaf.home=.|karaf.home=${NEXUS_HOME}|g" \
-e "s|karaf.base=.|karaf.base=${NEXUS_HOME}|g" \
-e "s|karaf.etc=etc|karaf.etc=${NEXUS_HOME}/etc|g" \
-e "s|java.util.logging.config.file=etc|java.util.logging.config.file=${NEXUS_HOME}/etc|g" \
-e "s|karaf.data=.*|karaf.data=${NEXUS_DATA}|g" \
-e "s|java.io.tmpdir=.*|java.io.tmpdir=${NEXUS_DATA}/tmp|g" \
-e "s|LogFile=.*|LogFile=${NEXUS_DATA}/log/jvm.log|g" \
-i ${NEXUS_HOME}/bin/nexus.vmoptions \
&& sed \
-e "s|nexus-context-path=/|nexus-context-path=/\${NEXUS_CONTEXT}|g" \
-i /opt/sonatype/nexus/etc/org.sonatype.nexus.cfg
-i ${NEXUS_HOME}/etc/nexus-default.properties \
&& mkdir -p ${NEXUS_DATA}/etc ${NEXUS_DATA}/log ${NEXUS_DATA}/tmp

RUN useradd -r -u 200 -m -c "nexus role account" -d ${NEXUS_DATA} -s /bin/false nexus
RUN useradd -r -u 200 -m -c "nexus role account" -d ${NEXUS_DATA} -s /bin/false nexus \
&& chown -R nexus:nexus ${NEXUS_DATA}

VOLUME ${NEXUS_DATA}

EXPOSE 8081
USER nexus
WORKDIR /opt/sonatype/nexus
WORKDIR ${NEXUS_HOME}

ENV JAVA_MAX_MEM=1200m \
JAVA_MIN_MEM=1200m \
Expand Down

0 comments on commit abac465

Please sign in to comment.