Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

Commit 6c7b0d0

Browse files
author
Bernhard Grünewaldt
committed
nexus 3.5.0 and HTTPS
1 parent e66f208 commit 6c7b0d0

File tree

3 files changed

+67
-14
lines changed

3 files changed

+67
-14
lines changed

Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
FROM codeclou/docker-oracle-jdk:8u131
1+
FROM codeclou/docker-oracle-jdk:8u141
22

3-
ENV NEXUS_OSS_VERSION 3.3.0-01
4-
ENV NEXUS_OSS_MD5SUM 54cf2d9da3cdeb6ab7dc54f0008bf9a7
3+
ENV NEXUS_OSS_VERSION 3.5.0-02
4+
ENV NEXUS_OSS_MD5SUM 12e92c23a17366c6a9838a4033d0e9e0
55

66
RUN addgroup -g 10777 worker && \
77
adduser -h /work -H -D -G worker -u 10777 worker && \
@@ -35,18 +35,20 @@ RUN addgroup -g 10777 worker && \
3535
COPY docker-entrypoint.sh /work-private/docker-entrypoint.sh
3636
RUN chmod u+rx,g+rx,o+rx,a-w /work-private/docker-entrypoint.sh && \
3737
chown -R worker:worker /work-private/
38-
38+
3939
#
4040
# WORKDIR
4141
#
4242
WORKDIR /work
43-
EXPOSE 8333
43+
EXPOSE 8443
4444

4545
#
4646
# RUN
4747
#
4848
USER worker
4949
ENV NEXUS_OSS_BASE /nexus-home
50+
ENV NEXUS_DOMAIN localhost
51+
ENV NEXUS_IP_ADDRESS 127.0.0.1
5052
VOLUME ["/work"]
5153
VOLUME ["/nexus-home"]
5254
ENTRYPOINT ["/work-private/docker-entrypoint.sh"]

README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Add the alias on your Docker-Host machine. Or configure a valid hostname in your
2727

2828
```bash
2929
sudo su
30-
echo "127.0.0.1 nexus-oss" >> /etc/hosts
30+
echo "127.0.0.1 nexus.home.codeclou.io" >> /etc/hosts
3131
```
3232

3333
**(2) Prepare the shared volume directory**
@@ -49,20 +49,38 @@ chown 10777:10777 /opt/nexus-oss-home
4949
```bash
5050
docker create \
5151
--name nexus \
52-
-p 8333:8333 \
52+
-p 8443:8443 \
5353
-v /opt/nexus-oss-home:/nexus-home \
54-
codeclou/docker-sonatype-nexus-repository-oss:3.3.0-01
54+
-e NEXUS_DOMAIN="nexus.home.codeclou.io" \
55+
-e NEXUS_IP_ADDRESS="192.168.178.66" \
56+
codeclou/docker-sonatype-nexus-repository-oss:3.5.0-02
5557

5658
docker start nexus
5759
```
5860

59-
60-
61+
Now it will print out the created self signed certificate which you will have to trust on all clients.
62+
63+
```
64+
DOCKER ENTRYPOINT >> =================================
65+
DOCKER ENTRYPOINT >>
66+
DOCKER ENTRYPOINT >> PLEASE TRUST THIS CERTIFICATE WHERE DOCKER RUNS AND ON CLIENT MACHINES
67+
68+
-----BEGIN CERTIFICATE-----
69+
MIID3DCCAsSgAwIBAgIEUMxHVjANBgkqhkiG9w0BAQsFADCBgTELMAkGA1UEBhMC
70+
...
71+
DlK8j8uOTohm/VxF3yd0CEWBOATh2iOHB2xL5LDphrQ=
72+
-----END CERTIFICATE-----
73+
74+
DOCKER ENTRYPOINT >>
75+
DOCKER ENTRYPOINT >> =================================
76+
DOCKER ENTRYPOINT >> you have 20sec to copy the cert and then nexus will start
77+
```
78+
6179
 
6280

6381
**(2) Start Post Configuration**
6482

65-
Now go to **[http://localhost:8333/](http://localhost:8333/)** and log in as `admin` with password `admin123`.
83+
Now go to **[https://nexus.home.codeclou.io:8443/](https://nexus.home.codeclou.io:8443/)** and log in as `admin` with password `admin123`.
6684

6785
Configure the Instance to your liking.
6886

@@ -88,7 +106,7 @@ Configure the Instance to your liking.
88106
* Ubuntu and Canonical are registered [trademarks of Canonical Ltd.](https://www.ubuntu.com/legal/short-terms)
89107
* **Apple**
90108
* macOS®, Mac and OS X are [trademarks of Apple Inc.](http://www.apple.com/legal/intellectual-property/trademark/appletmlist.html), registered in the U.S. and other countries.
91-
109+
92110
-----
93111

94112
 

docker-entrypoint.sh

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,42 @@ umask u+rxw,g+rwx,o-rwx
1111
sed -i 's@-Dkaraf.data=../sonatype-work/nexus3@-Dkaraf.data=/nexus-home@g' /nexus/nexus-latest/bin/nexus.vmoptions
1212
sed -i 's@-Djava.io.tmpdir=../sonatype-work/nexus3/tmp@-Djava.io.tmpdir=/nexus-home/tmp@g' /nexus/nexus-latest/bin/nexus.vmoptions
1313
sed -i 's@-XX:LogFile=../sonatype-work/nexus3/log/jvm.log@-XX:LogFile=/nexus-home/log/jvm.log@g' /nexus/nexus-latest/bin/nexus.vmoptions
14-
# see: http://books.sonatype.com/nexus-book/reference3/install.html#config-http-port
15-
sed -i 's@application-port=8081@application-port=8333@g' /nexus/nexus-latest/etc/nexus-default.properties
14+
sed -i 's@jetty-http.xml,@jetty-http.xml,${jetty.etc}/jetty-https.xml,@g' /nexus/nexus-latest/etc/nexus-default.properties
1615

16+
echo "" >> /nexus/nexus-latest/etc/nexus-default.properties
17+
echo "application-port-ssl=8443" >> /nexus/nexus-latest/etc/nexus-default.properties
18+
# We use default password 'password' for keystrore, so we do not have to patch
19+
# /nexus/nexus-latest/etc/jetty/jetty-https.xml
20+
21+
#
22+
# SSL (see doc: https://support.sonatype.com/hc/en-us/articles/217542177-Using-Self-Signed-Certificates-with-Nexus-Repository-Manager-and-Docker-Daemon)
23+
#
24+
keytool -genkeypair -keystore keystore.jks \
25+
-storepass password \
26+
-keypass password \
27+
-alias jetty \
28+
-keyalg RSA \
29+
-keysize 2048 \
30+
-validity 5000 \
31+
-dname "CN=${NEXUS_DOMAIN}, OU=Example, O=Sonatype, L=Unspecified, ST=Unspecified, C=US" \
32+
-ext "SAN=DNS:${NEXUS_DOMAIN},IP:${NEXUS_IP_ADDRESS}" \
33+
-ext "BC=ca:true"
34+
mv keystore.jks /nexus/nexus-latest/etc/ssl/
35+
36+
echo "DOCKER ENTRYPOINT >> ================================="
37+
echo "DOCKER ENTRYPOINT >> "
38+
echo "DOCKER ENTRYPOINT >> PLEASE TRUST THIS CERTIFICATE WHERE DOCKER RUNS AND ON CLIENT MACHINES"
39+
keytool -list -rfc -keystore /nexus/nexus-latest/etc/ssl/keystore.jks -storepass password
40+
echo "DOCKER ENTRYPOINT >> "
41+
echo "DOCKER ENTRYPOINT >> ================================="
42+
echo "DOCKER ENTRYPOINT >> you have 20sec to copy the cert and then nexus will start"
43+
sleep 20
44+
45+
46+
47+
#
48+
# DIR CHECKS
49+
#
1750
if [ ! -d /nexus-home/etc ]; then mkdir /nexus-home/etc; fi
1851
if [ ! -d /nexus-home/log ]; then mkdir /nexus-home/log; fi
1952
if [ ! -d /nexus-home/tmp ]; then mkdir /nexus-home/tmp; fi

0 commit comments

Comments
 (0)