diff --git a/nexus/3-alpine/Dockerfile b/nexus/3-alpine/Dockerfile new file mode 100644 index 0000000..445087e --- /dev/null +++ b/nexus/3-alpine/Dockerfile @@ -0,0 +1,36 @@ +FROM alpine:3.9 + +# https://github.com/cavemandaveman/nexus + +LABEL maintainer="cavemandaveman " + +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"] \ No newline at end of file diff --git a/nexus/3-alpine/bin/docker-entrypoint.sh b/nexus/3-alpine/bin/docker-entrypoint.sh new file mode 100644 index 0000000..60784c9 --- /dev/null +++ b/nexus/3-alpine/bin/docker-entrypoint.sh @@ -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|${JKS_PASSWORD}|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 "$@" \ No newline at end of file diff --git a/nexus/3-alpine/docker-compose.yml b/nexus/3-alpine/docker-compose.yml new file mode 100644 index 0000000..f49f726 --- /dev/null +++ b/nexus/3-alpine/docker-compose.yml @@ -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