diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 301dc12..7f55d90 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -58,11 +58,12 @@ RUN mkdir -p /usr/share/maven/conf && \ 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' \ 'xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 ' \ 'http://maven.apache.org/xsd/settings-1.0.0.xsd">' \ - '/etc/m2' \ + '/etc/m2/repository' \ '' > /usr/share/maven/conf/settings.xml -# Ensure the /etc/m2 directory exists -RUN mkdir -p /etc/m2 +# Ensure the /etc/m2 directory and subdirectories exist +RUN mkdir -p /etc/m2/repository +RUN mkdir -p /etc/m2/jgo_cache # Set the correct permissions RUN chmod -R 777 ${EXEC_DIR} && \ @@ -71,5 +72,11 @@ RUN chmod -R 777 ${EXEC_DIR} && \ RUN python3 -c 'import bfio; bfio.start()' +# Verify that the JAR file exists somewhere within /etc/m2 +RUN echo "Verifying JAR files in /etc/m2:" && \ + find /etc/m2 -name "formats-gpl-8.0.1.jar" -exec ls -lh {} \; && \ + echo "All JAR files in /etc/m2:" && \ + find /etc/m2 -name "*.jar" | head -20 + # Set the correct permissions again, for sanity RUN chmod -R 777 /etc/m2 diff --git a/docker/imagej/Dockerfile b/docker/imagej/Dockerfile index 4432744..adf3637 100644 --- a/docker/imagej/Dockerfile +++ b/docker/imagej/Dockerfile @@ -38,9 +38,6 @@ RUN python3 -m pip install --upgrade pip --no-cache-dir # Copy the source COPY . /bfio_src -# Apply m2 repo patch -RUN git apply --directory=bfio_src /bfio_src/docker/m2_repo.patch - # Install RUN python3 -m pip install /bfio_src --no-cache-dir @@ -64,12 +61,13 @@ RUN mkdir -p /usr/share/maven/conf && \ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 \ http://maven.apache.org/xsd/settings-1.0.0.xsd"> \ - /etc/m2 \ + /etc/m2/repository \ ' \ > /usr/share/maven/conf/settings.xml -# Ensure the /etc/m2 directory exists -RUN mkdir -p /etc/m2 +# Ensure the /etc/m2 directory and subdirectories exist +RUN mkdir -p /etc/m2/repository +RUN mkdir -p /etc/m2/jgo_cache # Set the correct permissions RUN chmod -R 777 ${EXEC_DIR} && \ @@ -77,6 +75,13 @@ RUN chmod -R 777 ${EXEC_DIR} && \ chmod -R 777 /etc/m2 RUN python3 -c 'import bfio; bfio.start()' + +# Verify that the JAR file exists somewhere within /etc/m2 +RUN echo "Verifying JAR files in /etc/m2:" && \ + find /etc/m2 -name "formats-gpl-8.0.1.jar" -exec ls -lh {} \; && \ + echo "First 10 JAR files in /etc/m2:" && \ + find /etc/m2 -name "*.jar" | head -10 + RUN python3 -c 'import imagej; ij = imagej.init(); print(ij.getVersion())' # Set the correct permissions again, for sanity diff --git a/docker/jgo_copy.patch b/docker/jgo_copy.patch deleted file mode 100644 index b23de5e..0000000 --- a/docker/jgo_copy.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/jgo/jgo.py b/jgo/jgo.py -index bd2b328..e2a824a 100644 ---- a/jgo/jgo.py -+++ b/jgo/jgo.py -@@ -710,7 +710,7 @@ def resolve_dependencies( - jar_file_in_workspace, - link_type=link_type, - ) -- except FileExistsError: -+ except (FileExistsError, shutil.SameFileError): - # Do not throw exception if target file exists. - pass - pathlib.Path(build_success_file).touch(exist_ok=True) diff --git a/docker/m2_repo.patch b/docker/m2_repo.patch index e25fbb6..6452eb2 100644 --- a/docker/m2_repo.patch +++ b/docker/m2_repo.patch @@ -2,11 +2,10 @@ diff --git a/src/bfio/utils.py b/src/bfio/utils.py index 954d682..cb88332 100644 --- a/src/bfio/utils.py +++ b/src/bfio/utils.py -@@ -40,6 +40,8 @@ try: - +@@ -40,6 +40,7 @@ try: + global JAR_VERSION scyjava.config.endpoints.append("ome:formats-gpl:8.0.1") -+ scyjava.config.set_m2_repo("/etc/m2/") + scyjava.config.set_cache_dir("/etc/m2/jgo_cache") scyjava.start_jvm() import loci diff --git a/docker/pyimagej_m2repo.patch b/docker/pyimagej_m2repo.patch index 7811974..e69a7b4 100644 --- a/docker/pyimagej_m2repo.patch +++ b/docker/pyimagej_m2repo.patch @@ -4,9 +4,9 @@ index 18aa9a8..74524ce 100644 +++ b/imagej/__init__.py @@ -1421,6 +1421,7 @@ def _create_jvm( sj.config.endpoints.extend(original_endpoints) - + try: -+ sj.config.set_m2_repo("/etc/m2/") ++ sj.config.set_cache_dir("/etc/m2/jgo_cache") sj.start_jvm() except subprocess.CalledProcessError as e: # Check to see if initialization failed due to "un-managed" diff --git a/docker/tensorflow/Dockerfile b/docker/tensorflow/Dockerfile index 4214c20..be0c313 100644 --- a/docker/tensorflow/Dockerfile +++ b/docker/tensorflow/Dockerfile @@ -46,11 +46,12 @@ RUN echo '' \ - '/etc/m2' \ + '/etc/m2/repository' \ '' > /usr/share/maven/conf/settings.xml -# Ensure the /etc/m2 directory exists -RUN mkdir -p /etc/m2 +# Ensure the /etc/m2 directory and subdirectories exist +RUN mkdir -p /etc/m2/repository +RUN mkdir -p /etc/m2/jgo_cache # Set the correct permissions RUN chmod -R 777 ${EXEC_DIR} && \ @@ -59,5 +60,11 @@ RUN chmod -R 777 ${EXEC_DIR} && \ RUN python3 -c 'import bfio; bfio.start()' +# Verify that the JAR file exists somewhere within /etc/m2 +RUN echo "Verifying JAR files in /etc/m2:" && \ + find /etc/m2 -name "formats-gpl-8.0.1.jar" -exec ls -lh {} \; && \ + echo "First 10 JAR files in /etc/m2:" && \ + find /etc/m2 -name "*.jar" | head -10 + # Set the correct permissions again, for sanity RUN chmod -R 777 /etc/m2