diff --git a/fiji-novnc-rocky/Dockerfile b/fiji-novnc-rocky/Dockerfile new file mode 100644 index 0000000..d535355 --- /dev/null +++ b/fiji-novnc-rocky/Dockerfile @@ -0,0 +1,58 @@ + +# +# Fiji + Java 8 Dockerfile +# + + +# Use Rocky 9.2-based RIS THPC image as base +FROM ghcr.io/washu-it-ris/novnc:rocky9.2 + + +# Define maintainer. +LABEL maintainer="japrewit@wustl.edu" +LABEL org.opencontainers.image.source="https://github.com/WashU-IT-RIS/fiji-dockerfiles" + +# Install OpenJDK 8 for Fiji +USER root +RUN dnf install -y java-1.8.0-openjdk-devel unzip wget \ + && dnf clean all + + +RUN useradd -u 1000 -ms /bin/bash fiji \ + && mkdir -p /opt/fiji \ + && chown -R fiji:fiji /opt/fiji + + +COPY entrypoint.sh /opt/fiji +RUN chown fiji:fiji /opt/fiji/entrypoint.sh \ + && chmod 755 /opt/fiji/entrypoint.sh + + +# Set HOME for the fiji user +ENV HOME /opt/fiji +USER fiji + + +# Define working directory. +WORKDIR /opt/fiji + +# Install Fiji. +RUN wget -q https://downloads.imagej.net/fiji/stable/fiji-stable-linux64-jdk.zip \ + && unzip fiji-stable-linux64-jdk.zip \ + && rm fiji-stable-linux64-jdk.zip + +# Add fiji to the PATH +ENV PATH $PATH:/opt/fiji/Fiji.app + + +# Define entrypoint. +ENTRYPOINT ["./entrypoint.sh"] + +# Update URLs use https +RUN ./entrypoint.sh --update edit-update-site ImageJ https://update.imagej.net/ +RUN ./entrypoint.sh --update edit-update-site Fiji https://update.fiji.sc/ +RUN ./entrypoint.sh --update edit-update-site Java-8 https://sites.imagej.net/Java-8/ + +# Run once to create Java preferences. +COPY --chown=fiji:fiji demo.py /opt/fiji/ +RUN ./entrypoint.sh --headless --ij2 --console --run ./demo.py 'name="test"' diff --git a/fiji-novnc-rocky/demo.py b/fiji-novnc-rocky/demo.py new file mode 100644 index 0000000..4efa7d5 --- /dev/null +++ b/fiji-novnc-rocky/demo.py @@ -0,0 +1,2 @@ +#@String name +print('Hello ' + name) \ No newline at end of file diff --git a/fiji-novnc-rocky/entrypoint.sh b/fiji-novnc-rocky/entrypoint.sh new file mode 100644 index 0000000..b40f22b --- /dev/null +++ b/fiji-novnc-rocky/entrypoint.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# Entrypoint for the docker image which tries to do +# the most sensible thing for the user: +# +# (A) If no arguments are passed, print help: +# $ docker run fiji +# +# (B) If no arguments are passed but a ternimal is requested, open a shell: +# $ docker run -ti fiji +# +# (C) Otherwise, assume arguments are to be passed to ImageJ-linux64: +# $ docker run fiji --console --run /my/script.py +# +# (D) Unless, the command starts with an executable, in which case run it: +# $ docker run fiji ImageJ-linux64 --console --run /my/script.py + +# Command run by default +IMAGEJ=${IMAGEJ:-"ImageJ-linux64 --headless --default-gc"} + +# For debugging purposes +RUN=${RUN:-exec} + +set -e + +if [[ $# -eq 0 ]] ; then + if [ -t 0 ] ; then + # (B) start a shell + $RUN bash + else + # (A) print help and exit + $RUN $IMAGEJ --help + fi +else + COMMAND=$1 + if command -v "$COMMAND" >/dev/null 2>&1; then + # (D) if the user has passed e.g. ImageJ-linux64, + # then run it verbatim for backwards compatibility + $RUN "$@" + else + # (C) Expected usage + $RUN $IMAGEJ "$@" + fi +fi