Created
April 14, 2016 14:57
-
-
Save geoHeil/c3d2ae98a553ace5602484bb8bf7605a to your computer and use it in GitHub Desktop.
Nexus 3 Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM phusion/baseimage | |
MAINTAINER Georg Heiler | |
ENV NEXUS_DATA /nexus-data | |
ENV NEXUS_VERSION 3.0.0-03 | |
RUN \ | |
apt-get update; apt-get upgrade -y -qq; \ | |
apt-get install -y -qq wget; \ | |
apt-get install -y -qq curl; \ | |
apt-get install -y -qq tar; \ | |
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
# install Oracle JRE | |
RUN \ | |
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \ | |
add-apt-repository -y ppa:webupd8team/java && \ | |
apt-get update && \ | |
apt-get install -y oracle-java8-installer && \ | |
rm -rf /var/lib/apt/lists/* && \ | |
rm -rf /var/cache/oracle-jdk8-installer && \ | |
rm -rf /tmp/* && \ | |
rm -rf /var/tmp/* | |
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle | |
# install nexus | |
RUN mkdir -p /opt/sonatype/nexus \ | |
&& 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 | |
## configure nexus runtime env | |
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 | |
RUN useradd -r -u 200 -m -c "nexus role account" -d ${NEXUS_DATA} -s /bin/false nexus | |
VOLUME ${NEXUS_DATA} | |
EXPOSE 8081 | |
#Setup docker + https + certificate | |
WORKDIR /opt/sonatype/nexus/etc | |
RUN mkdir ssl \ | |
&& cd ssl | |
COPY /files/certs/insecureNexus.pkcs12 /opt/sonatype/nexus/etc/ssl/insecureNexus.pkcs12 | |
COPY /files/certs/keystore.jks /opt/sonatype/nexus/etc/ssl/keystore.jks | |
COPY /files/org.sonatype.nexus.cfg /opt/sonatype/nexus/etc/org.sonatype.nexus.cfg | |
COPY /files/jetty-https.xml /opt/sonatype/nexus/etc/jetty-https.xml | |
# change password | |
# Run nexus | |
USER nexus | |
WORKDIR /opt/sonatype/nexus | |
ENV JAVA_MAX_MEM 1200m | |
ENV JAVA_MIN_MEM 1200m | |
ENV EXTRA_JAVA_OPTS "" | |
CMD bin/nexus run | |
############################################################# | |
FROM phusion/baseimage | |
MAINTAINER Georg Heiler | |
# Create the nexus user | |
RUN useradd -d "/var/nexus_home" -u 200 -m -s /bin/bash nexus | |
# Create the folders and volume mount points | |
RUN mkdir -p /nexus-data | |
RUN chown -R nexus:nexus /nexus-data | |
RUN mkdir -p /sonatype-work | |
RUN chown -R nexus:nexus /sonatype-work | |
VOLUME ["/nexus-data", "/sonatype-work"] | |
USER nexus | |
CMD ["echo", "Data container for nexus"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment