fiji / dockerfiles

Fiji Dockerfiles for Docker builds.
https://registry.hub.docker.com/u/fiji/fiji/
8 stars 9 forks source link

Download specific version #22

Closed junelsolis closed 2 years ago

junelsolis commented 2 years ago

https://github.com/fiji/dockerfiles/blob/faaccb166c6367b2cad47ee2fa4525acf5decef3/fiji-openjdk-8/Dockerfile#L19-L22

Is there a way to download a specific version of Fiji from the download site? I would like to create a Docker image with Fiji locked to a specific version like 2.2.0. At the moment, I think `https://downloads.imagej.net/fiji/latest points to 2.3.1 and https://downloads.imagej.net/fiji/archive/ only has 2.1.0

ctrueden commented 2 years ago

@junelsolis Here are two ways to get a specific version of Fiji:

From the archive

https://downloads.imagej.net/fiji/archive/

This is all the versions of Fiji that were ever packaged up from the current state of the core update site. Unfortunately, this archive is done by datestamp rather than Fiji version strings, because the update site contents do not always correspond 100% to Fiji release versions—plugin developers sometimes upload bug-fix releases in between formal Fiji releases.

Using Maven + Git

You can populate a Fiji application from the state of your local Fiji source code. Here is a sequence to clone Fiji at version 2.2.0 and then update a local Fiji application to match:

git clone --branch fiji-2.2.0 git://github.com/fiji/fiji
fiji/bin/populate-app.sh ~/Fiji.app

This assumes you already have a copy of Fiji as an application, unpacked at Fiji.app in your home directory, which you want to be populated (updated/overwritten) with (e.g.) the 2.2.0 release.

ctrueden commented 2 years ago

About Fiji Docker images: this repository is not too actively maintained right now, but suggestions are welcome regarding ways we could improve it to be more helpful. And if you have the bandwidth to help keep it updated, that would be most welcome.

junelsolis commented 2 years ago

@ctrueden Thanks for the info! I think fiji/bin/populate-app.sh is what I am looking for. I previously tried to build from source using Maven alone, but that didn't work out. If I'm not mistaken, this same script is also used to build the release files uploaded into https://downloads.imagej.net/fiji/archive/

About Fiji Docker images: this repository is not too actively maintained right now, but suggestions are welcome regarding ways we could improve it to be more helpful. And if you have the bandwidth to help keep it updated, that would be most welcome.

I think it would be helpful to have Dockerfiles that are also tagged not only with the Java version but also the Fiji version. For example: fiji/fiji:2.3.1-openjdk-8. Would this run into conflict with the situation of the update sites? In any case, I'd be happy to contribute Dockerfiles for these tags.

junelsolis commented 2 years ago

image

The script populate-app.sh has only been added as of fiji/fiji tag 2.3.1 so it won't work for building older versions.

ctrueden commented 2 years ago

It should work to grab the script independently, then run it on older source checkouts.

junelsolis commented 2 years ago

@ctrueden I hadn't thought of that. I tried it and it runs and in the built folder, I can see only two directories: jars and plugins. There is no ImageJ-linux64 executable like I'm used to seeing. Am I missing a build step somewhere? I tried looking in the main repository fiji/fiji within the bin directory, but I can't see what I'm missing.

Here's the relevant portions of the Dockerfile I'm experimenting with:

FROM openjdk:8

RUN apt-get update && apt-get install git -y && apt-get clean

RUN wget https://dlcdn.apache.org/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.zip \
    && unzip apache-maven-3.8.3-bin.zip \
    && rm apache-maven-3.8.3-bin.zip

ENV PATH="${PATH}:/apache-maven-3.8.3/bin"

RUN git clone --branch fiji-2.3.1 git://github.com/fiji/fiji
RUN mkdir /fiji-dist && ./fiji/bin/populate-app.sh /fiji-dist
ctrueden commented 2 years ago

From the comment at the top of populate-app.sh:

# Copies the state of this Fiji working copy into the given Fiji.app directory.
# This will ***ERASE ANY EXISTING JAR FILES*** in the given Fiji.app directory!
# This script is intended for updating an existing Fiji.app, so that the new
# state can then be uploaded to the core update site via the ImageJ Updater.

So, the original use case was if you already have a Fiji.app, e.g. one downloaded and unpacked from https://fiji.sc/#download, which you want to overwrite with a particular version of Fiji + dependencies.

Therefore, as a workaround for the moment, you could do:

wget https://downloads.imagej.net/fiji/latest/fiji-linux64.zip &&
unzip fiji-linux64.zip &&
populate-app.sh Fiji.app

However, it would be better for me to enhance this script to support building up the Fiji.app from scratch, as you tried to do. That was my eventual goal, but there are some tricky aspects to it. Making it populate the native launcher(s) is pretty straightforward, but making it also add all the other stuff (.lut, .m, .py, .rb, .bsh, .ijm, .js, .clj, .txt, macOS Contents folder, licenses folder with the third party licenses, bare native libs in lib folder, etc.) is more involved.

@junelsolis Are you OK with the workaround for now? I have some other deadlines right now, but I could make time to work on the script if the current situation is a blocker for you.

junelsolis commented 2 years ago

Hi @ctrueden thanks for taking the time. I ended up with the exact same workaround a couple hours ago, and I have a working container that serves the purpose.

Thank you for the help and your time.

ctrueden commented 2 years ago

@junelsolis Great, glad to hear it works!