1
1
# Download, extract Nexus to /tmp/sonatype/nexus
2
2
FROM eclipse-temurin:8-jre-jammy as downloader
3
3
4
- ARG NEXUS_VERSION=3.40.1 -01
4
+ ARG NEXUS_VERSION=3.43.0 -01
5
5
ARG NEXUS_DOWNLOAD_URL=https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz
6
6
7
7
# Download Nexus and other stuff we need later
8
8
# Use wget to improve performance (#11)
9
9
# Install wget
10
10
RUN apt update && apt install -y wget
11
- # Download jars required for OrientDB startup error hack
12
- RUN wget --quiet --directory-prefix=/tmp/ \
13
- https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.5.0/jna-5.5.0.jar \
14
- https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.5.0/jna-platform-5.5.0.jar
15
11
# Download + extract Nexus to "/tmp/sonatype/nexus" for use later
16
12
RUN wget --quiet --output-document=/tmp/nexus.tar.gz "${NEXUS_DOWNLOAD_URL}" && \
17
13
mkdir /tmp/sonatype && \
@@ -41,29 +37,18 @@ RUN \
41
37
# Work directory (/opt/sonatype/sonatype-work/nexus3)
42
38
ln -s /nexus-data /opt/sonatype/sonatype-work/nexus3
43
39
44
- # Setup: Start-up script (from official image)
45
- COPY files/opt/sonatype/start-nexus-repository-manager.sh /opt/sonatype/start-nexus-repository-manager.sh
46
- RUN chmod 755 /opt/sonatype/start-nexus-repository-manager.sh
47
-
48
40
# Fix-up: Startup command line: Remove hard-coded memory parameters in /opt/sonatype/nexus/bin/nexus.vmoptions (per official Docker image)
49
- RUN sed -i -e '/^-Xms\| ^-Xmx\| ^-XX:MaxDirectMemorySize/d' /opt/sonatype/nexus/bin/nexus.vmoptions
41
+ RUN sed -i '/^-Xms/d;/ ^-Xmx/d;/ ^-XX:MaxDirectMemorySize/d' /opt/sonatype/nexus/bin/nexus.vmoptions
50
42
51
43
# Enable NEXUS_CONTEXT env-variable via nexus-default.properties
52
44
RUN sed -i -e 's/^nexus-context-path=\/ /nexus-context-path=\/\$ {NEXUS_CONTEXT}/g' /opt/sonatype/nexus/etc/nexus-default.properties
53
45
54
- # Fix-up: Startup error with OrientDB on ARM - replace in-place 5.4.0 with 5.5.0 lib (reference is hard-coded in config files)
55
- # http://bhamail.github.io/pinexus/nexussetup.html
56
- COPY --from=downloader /tmp/jna-5.5.0.jar /opt/sonatype/nexus/system/net/java/dev/jna/jna/5.4.0/jna-5.4.0.jar
57
- COPY --from=downloader /tmp/jna-platform-5.5.0.jar /opt/sonatype/nexus/system/net/java/dev/jna/jna-platform/5.4.0/jna-platform-5.4.0.jar
58
- RUN chmod 644 \
59
- /opt/sonatype/nexus/system/net/java/dev/jna/jna/5.4.0/jna-5.4.0.jar \
60
- /opt/sonatype/nexus/system/net/java/dev/jna/jna-platform/5.4.0/jna-platform-5.4.0.jar
61
-
62
46
# Create Nexus user + group, based on official image:
63
47
# nexus:x:200:200:Nexus Repository Manager user:/opt/sonatype/nexus:/bin/false
64
48
# nexus:x:200:nexus
65
49
RUN groupadd --gid 200 nexus && \
66
50
useradd \
51
+ --system \
67
52
--shell /bin/false \
68
53
--comment 'Nexus Repository Manager user' \
69
54
--home-dir /opt/sonatype/nexus \
@@ -73,16 +58,22 @@ RUN groupadd --gid 200 nexus && \
73
58
--gid 200 \
74
59
nexus
75
60
76
- # Data directory "/nexus-data" owns "nexus" user
61
+ # Data directory "/nexus-data" owned by "nexus" user
77
62
RUN chown -R nexus:nexus /nexus-data
78
63
64
+ # Data volume
79
65
VOLUME /nexus-data
80
66
81
67
EXPOSE 8081
82
68
83
69
USER nexus
84
70
85
- ENV INSTALL4J_ADD_VM_PARAMS="-Xms1200m -Xmx1200m -XX:MaxDirectMemorySize=2g -Djava.util.prefs.userRoot=/nexus-data/javaprefs"
86
- ENV NEXUS_CONTEXT=''
71
+ # Default environment variables, adapted from upstream Dockerfile
72
+ ENV NEXUS_HOME=/opt/sonatype/nexus \
73
+ NEXUS_DATA=/nexus-data \
74
+ NEXUS_CONTEXT='' \
75
+ SONATYPE_WORK=/opt/sonatype/sonatype-work \
76
+ # Low `-Xms`, `-Xmx` default for Raspberry Pi
77
+ INSTALL4J_ADD_VM_PARAMS="-Xms1200m -Xmx1200m -XX:MaxDirectMemorySize=2g -Djava.util.prefs.userRoot=/nexus-data/javaprefs"
87
78
88
- CMD ["sh" , "-c" , " /opt/sonatype/start- nexus-repository-manager.sh " ]
79
+ CMD ["/opt/sonatype/nexus/bin/nexus" , "run " ]
0 commit comments