Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to customize nexus.properties #105

Open
ngpadp12 opened this issue May 8, 2022 · 1 comment
Open

Not able to customize nexus.properties #105

ngpadp12 opened this issue May 8, 2022 · 1 comment

Comments

@ngpadp12
Copy link

ngpadp12 commented May 8, 2022

In a dockerfile for nexus-app, I am trying to overwrite the nexus.properties file by copying a customized properties file over at /nexus-data/etc/ directory, after which the CMD directive runs and starts the nexus app.

COPY ./local-dir/nexus.template.properties ${NEXUS_DATA}/etc/nexus.properties

CMD ["sh", "-c", "${SONATYPE_DIR}/start-nexus-repository-manager.sh"]

This doesn't work however. The copy command works when i try to copy the template in the /home or /etc directories, but not when the COPY command runs on the /nexus-data or $SONATYPE_TYPE directories.

It seems that the start of nexus app (final command in the dockerfile) overwrites nexus.properties copied in the initial steps.

I would also like to know if there is an option/flag to pass an absolute custom path to the properties file (e.g. --config), I couldn't find any information about that either.

Any information about this would be of great help.
If such customization is not possible for docker images, please suggest alternatives to implement this.

Thanks!

@vazand
Copy link

vazand commented Feb 16, 2024

Hey, @ngpadp12 It is working for me:
I have update the entrypoint with my custom nexus.properties file

Dockerfile:

FROM sonatype/nexus3
ADD ./nexus.properties /opt/sonatype
ENV NEXUS_CONTEXT="nexus"
USER root
RUN chmod +x ./start-nexus-repository-manager.sh
USER nexus
ENTRYPOINT [ "./start-nexus-repository-manager.sh" ]
EXPOSE 8081

docker-compose.yaml

version: "3.8"

services:
    
  nexus_web:
    container_name: nexus_web
    build:
      context: .
      dockerfile: Dockerfile    
    ports:
      - "8081:8081"
    volumes:
      - nexus_docker_data:/nexus-data
volumes:
  nexus_docker_data:

start-nexus-repository-manager.sh:

#!/bin/bash
mv /opt/sonatype/nexus.properties /nexus-data/etc/nexus.properties
cd /opt/sonatype/nexus
exec ./bin/nexus run

nexus.properties:

# Jetty section
# application-port=8081
# application-host=0.0.0.0
# nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/${NEXUS_CONTEXT}

# Nexus section
# nexus-edition=nexus-pro-edition
# nexus-features=\
#  nexus-pro-feature

# nexus.hazelcast.discovery.isEnabled=true

Hope It helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants