Dockerfile for Nexus 3.0.0-m7

I needed a Dockerfile for Nexus 3 Milestone 7 and did not find one. Here it is:

FROM       centos:centos7

ENV SONATYPE_WORK /sonatype-work
ENV NEXUS_VERSION 3.0.0-m7

RUN yum install -y \
  curl tar createrepo \
  && yum clean all

RUN cd /var/tmp \
  && curl --fail --silent --location --retry 3 -O \
  --header "Cookie: oraclelicense=accept-securebackup-cookie; " \
  http://download.oracle.com/otn-pub/java/jdk/8u74-b02/jdk-8u74-linux-x64.rpm \
  && yum -y localinstall jdk-8u74-linux-x64.rpm \
  && rm -rf jdk-8u74-linux-x64.rpm

RUN mkdir -p /opt/sonatype && cd /opt/sonatype

RUN curl --fail --silent --location --retry 3 \
    http://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz \
  | tar xz -C /opt/sonatype nexus-* \
  && mv /opt/sonatype/nexus-* /opt/sonatype/nexus

RUN useradd -r -u 200 -m -c "nexus role account" -d ${SONATYPE_WORK} -s /bin/false nexus

VOLUME ${SONATYPE_WORK}

EXPOSE 8081
WORKDIR /opt/sonatype/nexus

RUN chown -R nexus:nexus /opt/sonatype/nexus

USER nexus

CMD /opt/sonatype/nexus/bin/nexus run

Comments are closed.