From 6a2a330728072276456723264586d1dcce42ce63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laurent?= <francois.laurent@posteo.net> Date: Thu, 9 Jun 2022 22:19:11 +0200 Subject: [PATCH] docker testing on Windows --- README.md | 2 +- recipes/Dockerfile | 4 ++-- recipes/README.md | 8 +++++--- scripts/larvatagger.sh | 9 ++++++--- test/precompile.sh | 3 ++- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0703838..af5e1d3 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ To natively run `LarvaTagger.jl`, you will need [`julia>=1.6`](https://julialang If you are not familiar with installing Julia, you may appreciate installation helpers such as [JILL.py](https://github.com/johnnychen94/jill.py). -Alternatively, if you have Docker installed, take a look at the [dedicated instructions page](https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/tree/docker/recipes). +Alternatively, if you have Docker installed, take a look at the [dedicated instructions page](https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/tree/main/recipes). ## Install diff --git a/recipes/Dockerfile b/recipes/Dockerfile index 04b44f0..da7c24f 100644 --- a/recipes/Dockerfile +++ b/recipes/Dockerfile @@ -9,8 +9,8 @@ RUN apt-get update && apt-get install -y \ && julia --project=$DIRNAME -e 'using Pkg; Pkg.instantiate()' \ && ln -s /$DIRNAME/scripts/larvatagger.jl /bin -# COPY requires at least one file defined, hence `test/precompile.jl` -COPY test/precompile.jl test/data_sample* $DIRNAME/test/ +# COPY requires at least one file defined, hence `test/precompile.sh` +COPY test/precompile.sh test/data_sample* $DIRNAME/test/ ARG TIMEZONE=UTC RUN ln -snf /usr/share/zoneinfo/$TIMEZONE /etc/localtime \ diff --git a/recipes/README.md b/recipes/README.md index eab2798..d1c7514 100644 --- a/recipes/README.md +++ b/recipes/README.md @@ -2,7 +2,7 @@ ## Getting available images -Images are published on [Docker Hub](https://hub.docker.com/repository/docker/flaur/larvatagger). +Images are published on [Docker Hub](https://hub.docker.com/r/flaur/larvatagger/tags). They ship with `LarvaTagger.jl` and, optionally, with a MaggotUBA-based toy backend for automatic tagging. @@ -11,17 +11,19 @@ Try: docker pull flaur/larvatagger:0.5-20220418 ``` -Beware that images that ship with backends are relatively large files (>6GB). +Beware that images that ship with backends are relatively large files (>6GB on disk). ## Running an image A number of options must be passed to the `docker` command for the container to open a data file: ``` -docker -iv $(pwd):/data -p 9284:9284 larvatagger open /data/path/to/your/file +docker -iv $(pwd):/data -p 9284:9284 larvatagger open /data/path/to/your/file --browser ``` with `path/to/your/file` a relative path to your file. +In PowerShell on Windows, use `${PWD}` instead of `$(pwd)`. + In the command above, `/data` represents the local directory, made available within the container. This is required, since no files outside the container can be accessed. diff --git a/scripts/larvatagger.sh b/scripts/larvatagger.sh index e90e367..c574c7d 100755 --- a/scripts/larvatagger.sh +++ b/scripts/larvatagger.sh @@ -33,12 +33,15 @@ fi done DOCKER_ARGS="--build-arg TIMEZONE=$(cat /etc/timezone) $DOCKER_ARGS" if [ "$BUILD" == "--dev" ]; then -docker build -t "${LARVATAGGER_IMAGE}:dev" -f recipes/Dockerfile.local ${DOCKER_ARGS}. +if ! [[ "$LARVATAGGER_IMAGE" == *:* ]]; then LARVATAGGER_IMAGE="${LARVATAGGER_IMAGE}:dev"; fi +docker build -t "$LARVATAGGER_IMAGE" -f recipes/Dockerfile.local ${DOCKER_ARGS}. elif [ "$BUILD" == "--stable" ]; then -docker build -t "${LARVATAGGER_IMAGE}:stable" -f recipes/Dockerfile ${DOCKER_ARGS}. +if ! [[ "$LARVATAGGER_IMAGE" == *:* ]]; then LARVATAGGER_IMAGE="${LARVATAGGER_IMAGE}:stable"; fi +docker build -t "$LARVATAGGER_IMAGE" -f recipes/Dockerfile ${DOCKER_ARGS}. else +if ! [[ "$LARVATAGGER_IMAGE" == *:* ]]; then LARVATAGGER_IMAGE="${LARVATAGGER_IMAGE}:latest"; fi if [ -z "$LARVATAGGER_DEFAULT_BRANCH" ]; then LARVATAGGER_DEFAULT_BRANCH=dev; fi -docker build -t "${LARVATAGGER_IMAGE}:latest" -f recipes/Dockerfile ${DOCKER_ARGS}--build-arg BRANCH=$LARVATAGGER_DEFAULT_BRANCH . +docker build -t "$LARVATAGGER_IMAGE" -f recipes/Dockerfile ${DOCKER_ARGS}--build-arg BRANCH=$LARVATAGGER_DEFAULT_BRANCH . fi #rm -rf ./external ;; diff --git a/test/precompile.sh b/test/precompile.sh index 970dfa4..6c25d91 100755 --- a/test/precompile.sh +++ b/test/precompile.sh @@ -25,7 +25,8 @@ using Pkg Pkg.add([\"$client\",\"PackageCompiler\"]) using PackageCompiler println(\"🢃 🢃 🢃 Includes logs from coverage script. Please ignore 🢃 🢃 🢃\") -create_sysimage(String[], sysimage_path=\"larvatagger.so\", precompile_execution_file=\"$script\") +create_sysimage(String[], sysimage_path=\"larvatagger.so\", precompile_execution_file=\"$script\", + cpu_target=PackageCompiler.default_app_cpu_target()) println(\"🢠🢠🢠Includes logs from coverage script. Please ignore 🢠🢠ðŸ¢\") #Pkg.rm([\"PackageCompiler\",\"$client\"])" -- GitLab