nexus is added

This commit is contained in:
병준 박 2019-05-12 14:29:45 +09:00
parent 1f98fc734c
commit 908b046034
3 changed files with 92 additions and 0 deletions

36
nexus/3-alpine/Dockerfile Normal file
View File

@ -0,0 +1,36 @@
FROM alpine:3.9
# https://github.com/cavemandaveman/nexus
LABEL maintainer="cavemandaveman <cavemandaveman@protonmail.com>"
ENV SONATYPE_DIR="/opt/sonatype"
ENV NEXUS_VERSION="3.16.1-02" \
NEXUS_HOME="${SONATYPE_DIR}/nexus" \
NEXUS_DATA="/nexus-data" \
SONATYPE_WORK=${SONATYPE_DIR}/sonatype-work \
JAVA_MIN_MEM="1200M" \
JAVA_MAX_MEM="1200M" \
JKS_PASSWORD="changeit"
RUN set -x \
&& apk --no-cache add \
openjdk8-jre-base \
libressl \
su-exec \
&& mkdir -p "${SONATYPE_DIR}" \
&& wget -qO - "https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz" \
| tar -zxC "${SONATYPE_DIR}" \
&& mv "${SONATYPE_DIR}/nexus-${NEXUS_VERSION}" "${NEXUS_HOME}" \
&& adduser -S -h ${NEXUS_DATA} nexus
EXPOSE 5000 8081 8443
WORKDIR "${NEXUS_HOME}"
VOLUME "${NEXUS_DATA}"
COPY bin/docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["bin/nexus", "run"]

View File

@ -0,0 +1,38 @@
#!/bin/sh
set -x
if [ "$1" = 'bin/nexus' ]; then
if [ -f "${NEXUS_DATA}/keystore.jks" ]; then
ln -s "${NEXUS_DATA}/keystore.jks" "${NEXUS_HOME}/etc/ssl/keystore.jks"
sed \
-e "s|password</Set>|${JKS_PASSWORD}</Set>|g" \
-i "${NEXUS_HOME}/etc/jetty/jetty-https.xml"
sed \
-e "s|nexus-args=.*|nexus-args=\${jetty.etc}/jetty.xml,\${jetty.etc}/jetty-http.xml,\${jetty.etc}/jetty-requestlog.xml,\${jetty.etc}/jetty-https.xml,\${jetty.etc}/jetty-http-redirect-to-https.xml|g" \
-i "${NEXUS_HOME}/etc/nexus-default.properties"
grep \
-q "application-port-ssl" "${NEXUS_HOME}/etc/nexus-default.properties" || \
sed \
-e "\|application-port|a\application-port-ssl=8443" \
-i "${NEXUS_HOME}/etc/nexus-default.properties"
fi
sed \
-e "s|-Xms.*|-Xms${JAVA_MIN_MEM}|g" \
-e "s|-Xmx.*|-Xmx${JAVA_MAX_MEM}|g" \
-i "${NEXUS_HOME}/bin/nexus.vmoptions"
if [ -d "${SONATYPE_WORK}/nexus3" ]; then
rm -rf "${SONATYPE_WORK}/nexus3"
fi
mkdir -p "${NEXUS_DATA}/etc" "${NEXUS_DATA}/log" "${NEXUS_DATA}/tmp" "${SONATYPE_WORK}"
ln -s "${NEXUS_DATA}" "${SONATYPE_WORK}/nexus3"
chown -R nexus "${NEXUS_DATA}" "${SONATYPE_WORK}"
exec su-exec nexus "$@"
fi
exec "$@"

View File

@ -0,0 +1,18 @@
version: "3"
services:
nexus:
restart: always
image: docker.loafle.net/library/nexus:3.16.1-02-alpine
container_name: nexus3
environment:
JAVA_MIN_MEM: "1200M"
JAVA_MAX_MEM: "1200M"
volumes:
- /service/nexus/data:/nexus-data
ports:
- "8081:8081"
ulimits:
nofile:
soft: 65536
hard: 65536