p2 support
flefevre opened this issue · 2 comments
Dear team
at first thanks a lot to share this work!
it is really great.
I would like to know if you could help me to modify your code to add p2 support to your nexus docker instance?
They are two plugins to install
https://books.sonatype.com/nexus-book/reference/p2-sect-intro.html
Nexus P2 Repository Plugin
Nexus P2 Bridge Plugin
Thanks
Francois from France
Hi Francois,
Thanks for the question- and apologies for the delayed response.
There are two primary options to install these plugins (aside from using Nexus Pro, which includes them):
- Install the plugins to the data volume used by the container. This approach uses only the runtime environment, i.e. would have to repeated if / when creating a new container from the image. One could use a data container or runtime volume mapping for this.
- Create your own Docker image, with these plugins, using sonatype/nexus:oss as the base.
I would suggest option 2 as the most portable, Something like the following would allow you to create your own Nexus OSS image with these two plugins.
$ cat Dockerfile
FROM sonatype/nexus:oss
USER root
RUN yum install -y unzip \
yum clean all
# install nexus-p2-repository-plugin
RUN curl --fail --silent --location --retry 3 \
-o /tmp/nexus-p2-repository-plugin-${NEXUS_VERSION}-bundle.zip \
https://repo1.maven.org/maven2/org/sonatype/nexus/plugins/nexus-p2-repository-plugin/${NEXUS_VERSION}/nexus-p2-repository-plugin-${NEXUS_VERSION}-bundle.zip \
&& unzip -d /opt/sonatype/nexus/nexus/WEB-INF/plugin-repository \
/tmp/nexus-p2-repository-plugin-${NEXUS_VERSION}-bundle.zip \
&& find /opt/sonatype/nexus/nexus/WEB-INF/plugin-repository/nexus-p2-repository-plugin-${NEXUS_VERSION} \
-type d -exec chmod 755 {} \; \
&& find /opt/sonatype/nexus/nexus/WEB-INF/plugin-repository/nexus-p2-repository-plugin-${NEXUS_VERSION} \
-type f -exec chmod 644 {} \; \
&& rm /tmp/nexus-p2-repository-plugin-${NEXUS_VERSION}-bundle.zip
# install nexus-p2-bridge-plugin
RUN curl --fail --silent --location --retry 3 \
-o /tmp/nexus-p2-bridge-plugin-${NEXUS_VERSION}-bundle.zip \
https://repo1.maven.org/maven2/org/sonatype/nexus/plugins/nexus-p2-bridge-plugin/${NEXUS_VERSION}/nexus-p2-bridge-plugin-${NEXUS_VERSION}-bundle.zip \
&& unzip -d /opt/sonatype/nexus/nexus/WEB-INF/plugin-repository \
/tmp/nexus-p2-bridge-plugin-${NEXUS_VERSION}-bundle.zip \
&& find /opt/sonatype/nexus/nexus/WEB-INF/plugin-repository/nexus-p2-bridge-plugin-${NEXUS_VERSION} \
-type d -exec chmod 755 {} \; \
&& find /opt/sonatype/nexus/nexus/WEB-INF/plugin-repository/nexus-p2-bridge-plugin-${NEXUS_VERSION} \
-type f -exec chmod 644 {} \; \
&& rm /tmp/nexus-p2-bridge-plugin-${NEXUS_VERSION}-bundle.zip
USER nexus
$ docker build --tag flefevre/nexus .
$ docker run -d -p 8081:8081 --name nexus flefevre/nexus
Since ARG NEXUS_VERSION introduced, it is not being propagated to the extending Dockerfile. One should define ARG NEXUS_VERSION=2.14.2-01
to get the solution working. Is there a better way to propagate the ARG from parent?