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

Docker: Add optional EXTRA_JAVA_OPTIONS environment variable #2040

Merged
merged 3 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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