Compare commits

...

7 Commits

Author SHA1 Message Date
Brad Beck 9ee35fedf9 Updating to NXRM 3.2.0-01 2016-12-16 12:17:28 -06:00
Brad Beck 1d3a2851a9 Introduce build arguments (#58)
Allow NEXUS_VERSION and NEXUS_DOWNLOAD_URL to be overridden at build time, e.g.

docker build -t nexus-custom --build-arg NEXUS_VERSION=3.2.0-SNAPSHOT --build-arg NEXUS_DOWNLOAD_URL=http://.../nexus-....-unix.tar.gz .
2016-12-12 14:18:16 -06:00
Joe Tom a9fe8de83e Merge pull request #54 from sonatype/joedragons-patch-1
Updating references to the non-deprecated image and header
2016-11-11 11:43:59 -05:00
Joe Tom 338e9dfcff Header change 2016-11-11 11:43:35 -05:00
Joe Tom 14a5413d9e Updating references to the non-deprecated image 2016-11-09 17:45:15 -05:00
Brad Beck cd24b0ade1 Updated JRE and reduced custom config (#51) 2016-11-04 10:15:42 -08:00
Yu-Lung Shao (Allen) e893e36611 update [Managing Data in Containers] url (#49) 2016-11-01 09:28:55 -08:00
2 changed files with 34 additions and 27 deletions
+14 -18
View File
@@ -20,6 +20,9 @@ LABEL vendor=Sonatype \
com.sonatype.license="Apache License, Version 2.0" \
com.sonatype.name="Nexus Repository Manager base image"
ARG NEXUS_VERSION=3.2.0-01
ARG NEXUS_DOWNLOAD_URL=https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz
RUN yum install -y \
curl tar \
&& yum clean all
@@ -27,14 +30,15 @@ RUN yum install -y \
# configure java runtime
ENV JAVA_HOME=/opt/java \
JAVA_VERSION_MAJOR=8 \
JAVA_VERSION_MINOR=102 \
JAVA_VERSION_BUILD=14
JAVA_VERSION_MINOR=112 \
JAVA_VERSION_BUILD=15
# configure nexus runtime
ENV NEXUS_VERSION=3.1.0-04 \
NEXUS_HOME=/opt/sonatype/nexus \
ENV SONATYPE_DIR=/opt/sonatype
ENV NEXUS_HOME=${SONATYPE_DIR}/nexus \
NEXUS_DATA=/nexus-data \
NEXUS_CONTEXT=''
NEXUS_CONTEXT='' \
SONATYPE_WORK=${SONATYPE_DIR}/sonatype-work
# install Oracle JRE
RUN mkdir -p /opt \
@@ -48,27 +52,19 @@ RUN mkdir -p /opt \
# install nexus
RUN mkdir -p ${NEXUS_HOME} \
&& curl --fail --silent --location --retry 3 \
https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz \
${NEXUS_DOWNLOAD_URL} \
| gunzip \
| tar x -C ${NEXUS_HOME} --strip-components=1 nexus-${NEXUS_VERSION} \
&& chown -R root:root ${NEXUS_HOME}
# configure nexus
RUN sed \
-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 ${NEXUS_HOME}/etc/nexus-default.properties \
&& mkdir -p ${NEXUS_DATA}/etc ${NEXUS_DATA}/log ${NEXUS_DATA}/tmp
-e '/^nexus-context/ s:$:${NEXUS_CONTEXT}:' \
-i ${NEXUS_HOME}/etc/nexus-default.properties
RUN useradd -r -u 200 -m -c "nexus role account" -d ${NEXUS_DATA} -s /bin/false nexus \
&& mkdir -p ${NEXUS_DATA}/etc ${NEXUS_DATA}/log ${NEXUS_DATA}/tmp ${SONATYPE_WORK} \
&& ln -s ${NEXUS_DATA} ${SONATYPE_WORK}/nexus3 \
&& chown -R nexus:nexus ${NEXUS_DATA}
VOLUME ${NEXUS_DATA}
+20 -9
View File
@@ -1,15 +1,16 @@
# sonatype/docker-nexus3
# Sonatype Nexus3 Docker: sonatype/nexus3
A Dockerfile for Sonatype Nexus Repository Manager 3, based on CentOS.
* [Notes](#notes)
* [Persistent Data](#persistent-data)
* [Build Args](#build-args)
* [Getting Help](#getting-help)
To run, binding the exposed port 8081 to the host.
```
$ docker run -d -p 8081:8081 --name nexus sonatype/docker-nexus3
$ docker run -d -p 8081:8081 --name nexus sonatype/nexus3
```
To test:
@@ -23,7 +24,7 @@ To (re)build the image:
Copy the Dockerfile and do the build-
```
$ docker build --rm=true --tag=sonatype/docker-nexus3 .
$ docker build --rm=true --tag=sonatype/nexus3 .
```
## Notes
@@ -55,7 +56,7 @@ process, which runs as UID 200.
These can be used supplied at runtime to control the JVM:
```
$ docker run -d -p 8081:8081 --name nexus -e JAVA_MAX_MEM=768m sonatype/docker-nexus3
$ docker run -d -p 8081:8081 --name nexus -e JAVA_MAX_MEM=768m sonatype/nexus3
```
* Another environment variable can be used to control the Nexus Context Path
@@ -65,22 +66,22 @@ process, which runs as UID 200.
This can be supplied at runtime:
```
$ docker run -d -p 8081:8081 --name nexus -e NEXUS_CONTEXT=nexus sonatype/docker-nexus3
$ docker run -d -p 8081:8081 --name nexus -e NEXUS_CONTEXT=nexus sonatype/nexus3
```
### Persistent Data
There are two general approaches to handling persistent storage requirements
with Docker. See [Managing Data in Containers](https://docs.docker.com/userguide/dockervolumes/)
with Docker. See [Managing Data in Containers](https://docs.docker.com/engine/tutorials/dockervolumes/)
for additional information.
1. *Use a data volume*. Since data volumes are persistent
until no containers use them, a volume can be created specifically for
until no containers use them, a volume can be created specifically for
this purpose. This is the recommended approach.
```
$ docker volume create --name nexus-data
$ docker run -d -p 8081:8081 --name nexus -v nexus-data:/nexus-data sonatype/docker-nexus3
$ docker run -d -p 8081:8081 --name nexus -v nexus-data:/nexus-data sonatype/nexus3
```
2. *Mount a host directory as the volume*. This is not portable, as it
@@ -90,9 +91,19 @@ for additional information.
```
$ mkdir /some/dir/nexus-data && chown -R 200 /some/dir/nexus-data
$ docker run -d -p 8081:8081 --name nexus -v /some/dir/nexus-data:/nexus-data sonatype/docker-nexus3
$ docker run -d -p 8081:8081 --name nexus -v /some/dir/nexus-data:/nexus-data sonatype/nexus3
```
### Build Args
The Dockerfile contains two build arguments (`NEXUS_VERSION` & `NEXUS_DOWNLOAD_URL`) that can be used to customize what
version of, and from where, Nexus Repository Manager is downloaded. This is useful mostly for testing purposes as the
Dockerfile may be dependent on a very specific version of Nexus Repository Manager.
```
docker build --rm --tag nexus-custom --build-arg NEXUS_VERSION=3.x.y --build-arg NEXUS_DOWNLOAD_URL=http://.../nexus-3.x.y-unix.tar.gz .
```
## Getting Help
Looking to contribute to our Docker image but need some help? There's a few ways to get information or our attention: