Can I add a custom jar file to the lib directory?
Closed this issue · 2 comments
I'm talking about: /usr/share/openfire/lib
.
The reason I want to make volume here is because I'm using custom auth. To change the value of provider.auth.className
property, I need to assign a lib file to this directory.
When I do this by adding volume myself:
openfire_1 | Error: Unable to access jarfile /usr/share/openfire/lib/startup.jar.
Method I followed:
- Add ENV variable in Dockerfile:
OPENFIRE_LIB_DIR=/usr/share/openfire/lib
- Add VOLUME in Dockerfile:
VOLUME ["${OPENFIRE_LIB_DIR}"]
- Add initialize_lib_dir in entrypoint.sh:
+initialize_lib_dir() {
+ echo "Initializing ${OPENFIRE_LIB_DIR}..."
+
+ mkdir -p ${OPENFIRE_LIB_DIR}
+ chmod -R 0770 ${OPENFIRE_LIB_DIR}
+ chown -R ${OPENFIRE_USER}:${OPENFIRE_USER} ${OPENFIRE_LIB_DIR}
+}
+
initialize_log_dir() {
echo "Initializing ${OPENFIRE_LOG_DIR}..."
mkdir -p ${OPENFIRE_LOG_DIR}
@@ -59,6 +67,7 @@ fi
rewire_openfire
initialize_data_dir
+initialize_lib_dir
initialize_log_dir
And then I defined a volume with docker-compose and created this directory on my computer.
Wouldn't it be easier to use either -cp
or the CLASSPATH
environment variable to load your class from a separate volume/directory? You can specify JVM arguments in the command
key of the service in your docker-compose file.
Because these are core application files that may change with each release, I think it's best to keep them separate. Using either solution suggested above will allow you to inject custom classes without requiring you to synchronize files from the application each time it's updated.