Skip to content

Commit

Permalink
Merge pull request #2040 from valentijnscholten/extra-java-options
Browse files Browse the repository at this point in the history
Docker: Add optional EXTRA_JAVA_OPTIONS environment variable
  • Loading branch information
nscuro authored Oct 13, 2022
2 parents 51e24e3 + b798f1d commit 9c0b078
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
8 changes: 6 additions & 2 deletions docs/_docs/getting-started/deploy-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,14 @@ services:
# - ALPINE_METRICS_ENABLED=true
# - ALPINE_METRICS_AUTH_USERNAME=
# - ALPINE_METRICS_AUTH_PASSWORD=
#
#
# Optional environmental variables to enable default notification publisher templates override and set the base directory to search for templates
# - DEFAULT_TEMPLATES_OVERRIDE_ENABLED=false
# - DEFAULT_TEMPLATES_OVERRIDE_BASE_DIRECTORY=/data
#
# Optional environmental variables to provide more JVM arguments to the API Server JVM, i.e. "-XX:ActiveProcessorCount=8"
# - EXTRA_JAVA_OPTIONS=

deploy:
resources:
limits:
Expand All @@ -166,7 +170,7 @@ services:
- '8081:8080'
volumes:
# Optional volume mount to override default notification publisher templates
# - "/host/path/to/template/base/dir:/data/templates"
# - "/host/path/to/template/base/dir:/data/templates"
- 'dependency-track:/data'
restart: unless-stopped

Expand Down
6 changes: 4 additions & 2 deletions src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ ARG WAR_FILENAME=dependency-track-apiserver.jar
ENV TZ=Etc/UTC \
# Dependency-Track's default logging level
LOGGING_LEVEL=INFO \
# Environment variables that can be passed at runtime
# JVM Options that are passed at runtime by default
JAVA_OPTIONS="-XX:+UseParallelGC -XX:MaxRAMPercentage=90.0" \
# JVM Options that can be passed at runtime, while maintaining also those set in JAVA_OPTIONS
EXTRA_JAVA_OPTIONS="" \
# The web context defaults to the root. To override, supply an alternative context which starts with a / but does not end with one
# Example: /dtrack
CONTEXT="/" \
Expand Down Expand Up @@ -59,7 +61,7 @@ USER ${UID}
WORKDIR ${APP_DIR}

# Launch Dependency-Track
CMD java ${JAVA_OPTIONS} --add-opens java.base/java.util.concurrent=ALL-UNNAMED -DdependencyTrack.logging.level=${LOGGING_LEVEL} -jar ${WAR_FILENAME} -context ${CONTEXT}
CMD java ${JAVA_OPTIONS} ${EXTRA_JAVA_OPTIONS} --add-opens java.base/java.util.concurrent=ALL-UNNAMED -DdependencyTrack.logging.level=${LOGGING_LEVEL} -jar ${WAR_FILENAME} -context ${CONTEXT}

# Specify which port Dependency-Track listens on
EXPOSE 8080
Expand Down
8 changes: 7 additions & 1 deletion src/main/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ services:
# - ALPINE_METRICS_ENABLED=true
# - ALPINE_METRICS_AUTH_USERNAME=
# - ALPINE_METRICS_AUTH_PASSWORD=
#
# Optional environmental variables to enable default notification publisher templates override and set the base directory to search for templates
# - DEFAULT_TEMPLATES_OVERRIDE_ENABLED=false
# - DEFAULT_TEMPLATES_OVERRIDE_BASE_DIRECTORY=/data
#
# Optional environmental variables to provide more JVM arguments to the API Server JVM, i.e. "-XX:ActiveProcessorCount=8"
# - EXTRA_JAVA_OPTIONS=
deploy:
resources:
limits:
Expand Down Expand Up @@ -116,4 +123,3 @@ services:
ports:
- "8080:8080"
restart: unless-stopped

0 comments on commit 9c0b078

Please sign in to comment.