Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 135a1c6493 | |||
| 1f5f927d71 | |||
| 97d3daf7fe | |||
| 222b63f15d | |||
| 7a91327b7f | |||
| 65915646ed | |||
| b7e9f09126 | |||
| 04c718287b | |||
| 2d1f4aaa59 | |||
| 6de8a22e19 | |||
| 9ee35fedf9 | |||
| 1d3a2851a9 | |||
| a9fe8de83e | |||
| 338e9dfcff | |||
| 14a5413d9e | |||
| cd24b0ade1 | |||
| e893e36611 |
+20
-21
@@ -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.4.0-02
|
||||
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,20 +30,22 @@ 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=131 \
|
||||
JAVA_VERSION_BUILD=11 \
|
||||
JAVA_DOWNLOAD_HASH=d54c1d3a095b4ff2b6607d096fa80163
|
||||
|
||||
# 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 \
|
||||
&& curl --fail --silent --location --retry 3 \
|
||||
--header "Cookie: oraclelicense=accept-securebackup-cookie; " \
|
||||
http://download.oracle.com/otn-pub/java/jdk/${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-b${JAVA_VERSION_BUILD}/server-jre-${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-linux-x64.tar.gz \
|
||||
http://download.oracle.com/otn-pub/java/jdk/${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-b${JAVA_VERSION_BUILD}/${JAVA_DOWNLOAD_HASH}/server-jre-${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-linux-x64.tar.gz \
|
||||
| gunzip \
|
||||
| tar -x -C /opt \
|
||||
&& ln -s /opt/jdk1.${JAVA_VERSION_MAJOR}.0_${JAVA_VERSION_MINOR} ${JAVA_HOME}
|
||||
@@ -48,27 +53,23 @@ 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" \
|
||||
-e '/^nexus-context/ s:$:${NEXUS_CONTEXT}:' \
|
||||
-i ${NEXUS_HOME}/etc/nexus-default.properties \
|
||||
&& mkdir -p ${NEXUS_DATA}/etc ${NEXUS_DATA}/log ${NEXUS_DATA}/tmp
|
||||
&& sed \
|
||||
-e '/^-Xms/d' \
|
||||
-e '/^-Xmx/d' \
|
||||
-i ${NEXUS_HOME}/bin/nexus.vmoptions
|
||||
|
||||
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}
|
||||
@@ -77,8 +78,6 @@ EXPOSE 8081
|
||||
USER nexus
|
||||
WORKDIR ${NEXUS_HOME}
|
||||
|
||||
ENV JAVA_MAX_MEM=1200m \
|
||||
JAVA_MIN_MEM=1200m \
|
||||
EXTRA_JAVA_OPTS=""
|
||||
ENV INSTALL4J_ADD_VM_PARAMS="-Xms1200m -Xmx1200m"
|
||||
|
||||
CMD ["bin/nexus", "run"]
|
||||
|
||||
@@ -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
|
||||
@@ -43,19 +44,14 @@ $ docker logs -f nexus
|
||||
logs, and storage. This directory needs to be writable by the Nexus
|
||||
process, which runs as UID 200.
|
||||
|
||||
* Three environment variables can be used to control the JVM arguments
|
||||
* There is an environment variable that can used to pass JVM arguments to the startup script
|
||||
|
||||
* `JAVA_MAX_MEM`, passed as -Xmx. Defaults to `1200m`.
|
||||
* `INSTALL4J_ADD_VM_PARAMS`, passed to the Install4J startup script. Defaults to `-Xms1200m -Xmx1200m`.
|
||||
|
||||
* `JAVA_MIN_MEM`, passed as -Xms. Defaults to `1200m`.
|
||||
|
||||
* `EXTRA_JAVA_OPTS`. Additional options can be passed to the JVM via
|
||||
this variable.
|
||||
|
||||
These can be used supplied at runtime to control the JVM:
|
||||
This can be supplied at runtime:
|
||||
|
||||
```
|
||||
$ 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 INSTALL4J_ADD_VM_PARAMS="-Xms2g -Xmx2g" sonatype/nexus3
|
||||
```
|
||||
|
||||
* Another environment variable can be used to control the Nexus Context Path
|
||||
@@ -65,22 +61,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,13 +86,23 @@ 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:
|
||||
|
||||
* File a public issue [here on GitHub](https://github.com/sonatype/docker-nexus3/issues)
|
||||
* File an issue [on our public JIRA](https://issues.sonatype.org/projects/NEXUS/)
|
||||
* Check out the [Nexus3](http://stackoverflow.com/questions/tagged/nexus3) tag on Stack Overflow
|
||||
* Check out the [Nexus Repository User List](https://groups.google.com/a/glists.sonatype.com/forum/?hl=en#!forum/nexus-users)
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ version: "2"
|
||||
|
||||
services:
|
||||
nexus:
|
||||
image: sonatype/docker-nexus3
|
||||
image: sonatype/nexus3
|
||||
volumes:
|
||||
- "nexus-data:/nexus-data"
|
||||
ports:
|
||||
|
||||
Reference in New Issue
Block a user