Skip to content
Snippets Groups Projects
Commit 0f850692 authored by François  LAURENT's avatar François LAURENT
Browse files

bootstrap slightly accelerated

parent 0369476f
No related branches found
No related tags found
No related merge requests found
Pipeline #83035 passed
...@@ -8,7 +8,6 @@ Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" ...@@ -8,7 +8,6 @@ Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DocOpt = "968ba79b-81e4-546f-ab3a-2eecfa62a9db" DocOpt = "968ba79b-81e4-546f-ab3a-2eecfa62a9db"
Formatting = "59287772-0a20-5a39-b81b-1366585eb4c0" Formatting = "59287772-0a20-5a39-b81b-1366585eb4c0"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
JSServe = "824d6782-a2ef-11e9-3a09-e5662e0c26f9" JSServe = "824d6782-a2ef-11e9-3a09-e5662e0c26f9"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
......
FROM ubuntu:focal FROM julia:1.7.3-bullseye
RUN apt-get update &&\
apt-get install -y wget git &&\
wget https://raw.githubusercontent.com/abelsiqueira/jill/main/jill.sh &&\
bash jill.sh -y &&\
rm jill.sh
ENV DIRNAME app ENV DIRNAME app
ARG BRANCH=main ARG BRANCH=main
RUN git clone --depth 1 --single-branch -b $BRANCH https://gitlab.pasteur.fr/nyx/larvatagger.jl $DIRNAME &&\ RUN apt-get update && apt-get install -y \
cd $DIRNAME &&\ git \
julia --project=. -e 'using Pkg; Pkg.instantiate()' &&\ && rm -rf /var/lib/apt/lists/* \
ln -s $(pwd)/scripts/larvatagger.jl /bin && git clone --depth 1 --single-branch -b $BRANCH https://gitlab.pasteur.fr/nyx/larvatagger.jl $DIRNAME \
&& julia --project=$DIRNAME -e 'using Pkg; Pkg.instantiate()' \
&& ln -s /$DIRNAME/scripts/larvatagger.jl /bin
COPY test/precompile.* test/data_sample* $DIRNAME/test/
COPY ./extra $DIRNAME/ ARG TIMEZONE=UTC
RUN ln -snf /usr/share/zoneinfo/$TIMEZONE /etc/localtime \
&& echo $TIMEZONE > /etc/timezone \
&& $DIRNAME/test/precompile.sh --shallow \
&& rm -f test/data_sample*
COPY external $DIRNAME/
ARG BACKEND ARG BACKEND
RUN if [ "$BACKEND" = "MaggotUBA_20220418" ]; then \ RUN if [ "$BACKEND" = "MaggotUBA/20220418" ]; then \
apt-get install -y python3-pip &&\ apt-get update && apt-get install -y \
python3 -m pip install poetry &&\ python3-pip \
cd $DIRNAME &&\ && python3 -m pip install poetry \
git clone --depth 1 --single-branch -b 20220418 https://gitlab.pasteur.fr/nyx/MaggotUBA-adapter MaggotUBA &&\ && cd $DIRNAME \
cd MaggotUBA &&\ && git clone --depth 1 --single-branch -b 20220418 https://gitlab.pasteur.fr/nyx/MaggotUBA-adapter MaggotUBA \
python3 -m poetry remove structured-temporal-convolution &&\ && cd MaggotUBA \
python3 -m poetry add ../structured-temporal-convolution &&\ && python3 -m poetry remove structured-temporal-convolution \
python3 -m poetry install; \ && python3 -m poetry add ../structured-temporal-convolution \
&& python3 -m poetry install \
&& rm -rf /var/lib/apt/lists/*; \
fi fi
WORKDIR $DIRNAME
ENTRYPOINT ["larvatagger.jl"] ENTRYPOINT ["larvatagger.jl"]
FROM ubuntu:jammy FROM julia:1.7.3-bullseye
RUN apt-get update &&\
apt-get install -y wget git &&\
wget https://raw.githubusercontent.com/abelsiqueira/jill/main/jill.sh &&\
bash jill.sh -y &&\
rm jill.sh
COPY src /app/src/ COPY src /app/src/
COPY scripts /app/scripts/ COPY scripts /app/scripts/
COPY Project.toml Manifest.toml /app/ COPY Project.toml Manifest.toml /app/
RUN cd /app &&\ RUN apt-get update && apt-get install -y \
julia --project=. -e 'using Pkg; Pkg.instantiate()' &&\ git \
&& rm -rf /var/lib/apt/lists/* \
&& cd /app \
&& julia --project=. -e 'using Pkg; Pkg.instantiate()' \
ln -s /app/scripts/larvatagger.jl /bin ln -s /app/scripts/larvatagger.jl /bin
ENTRYPOINT ["larvatagger.jl"] ENTRYPOINT ["larvatagger.jl"]
...@@ -12,13 +12,13 @@ if ! [ -f recipes/Dockerfile ]; then ...@@ -12,13 +12,13 @@ if ! [ -f recipes/Dockerfile ]; then
echo "the build command can only be run from the project root directory" echo "the build command can only be run from the project root directory"
exit 1 exit 1
fi fi
mkdir -p ./extra mkdir -p ./external
while ! [ -z "$1" ]; do while ! [ -z "$1" ]; do
if [ "$1" == "--dev" -o "$1" == "--stable" ]; then if [ "$1" == "--dev" -o "$1" == "--stable" ]; then
BUILD=$1; shift BUILD=$1; shift
elif [ "$1" == "--get-backend" ]; then elif [ "$1" == "--get-backend" ]; then
BACKEND="--build-arg BACKEND=MaggotUBA_20220418"; shift DOCKER_ARGS="--build-arg BACKEND=MaggotUBA/20220418 "; shift
cd ./extra cd ./external
if [ -d structured-temporal-convolution ]; then if [ -d structured-temporal-convolution ]; then
cd structured-temporal-convolution; git pull; cd .. cd structured-temporal-convolution; git pull; cd ..
else else
...@@ -27,28 +27,32 @@ fi ...@@ -27,28 +27,32 @@ fi
cd .. cd ..
else else
echo "argument not supported: $1"; shift echo "argument not supported: $1"; shift
#rm -rf ./extra #rm -rf ./external
exit 1 exit 1
fi fi
done done
DOCKER_ARGS="--build-arg TIMEZONE=$(cat /etc/timezone) $DOCKER_ARGS"
if [ "$BUILD" == "--dev" ]; then if [ "$BUILD" == "--dev" ]; then
docker build -t "${LARVATAGGER_IMAGE}:dev" -f recipes/Dockerfile.local $BACKEND . docker build -t "${LARVATAGGER_IMAGE}:dev" -f recipes/Dockerfile.local ${DOCKER_ARGS}.
elif [ "$BUILD" == "--stable" ]; then elif [ "$BUILD" == "--stable" ]; then
docker build -t "$LARVATAGGER_IMAGE:stable" -f recipes/Dockerfile $BACKEND . docker build -t "${LARVATAGGER_IMAGE}:stable" -f recipes/Dockerfile ${DOCKER_ARGS}.
else else
docker build -t "$LARVATAGGER_IMAGE:latest" -f recipes/Dockerfile $BACKEND --build-arg BRANCH=dev . docker build -t "${LARVATAGGER_IMAGE}:latest" -f recipes/Dockerfile ${DOCKER_ARGS}--build-arg BRANCH=dev .
fi fi
#rm -rf ./extra #rm -rf ./external
;; ;;
open) open)
ARGS="-p 9284:9284" if [ -z "$LARVATAGGER_PORT" -o "$LARVATAGGER_PORT" == "9284" ]; then
if ! [ -z "$LARVATAGGER_PORT" -o "$LARVATAGGER_PORT" == "9284" ]; then DOCKER_ARGS="-p 9284:9284"
ARGS="-p $LARVATAGGER_PORT:9284 $ARGS" TAGGER_ARGS=
else
DOCKER_ARGS="-p $LARVATAGGER_PORT:$LARVATAGGER_PORT"
TAGGER_ARGS="--port=$LARVATAGGER_PORT"
fi fi
file=$1; shift file=$1; shift
exec docker run -iv $(pwd):/data $ARGS "$LARVATAGGER_IMAGE" open "/data/$file" $@ exec docker run -iv $(pwd):/data $DOCKER_ARGS "$LARVATAGGER_IMAGE" open "/data/$file" $TAGGER_ARGS $@
;; ;;
import) import)
......
using LarvaTagger
using JSServe: Server
datafile = joinpath(@__DIR__, "data_sample")
ispath(datafile) || exit()
app = larvaeditor(datafile)
srv = Server(app, "0.0.0.0", 9284)
if isempty(ARGS)
using HTTP
HTTP.request(:GET, "http://127.0.0.1:9284")
elseif ARGS == ["--electron"]
using Blink
win = Window(async=false)
loadurl(win, "http://127.0.0.1:9284")
close(win)
end
close(srv)
#!/bin/sh
root=$(dirname $(dirname $0))
if [ "$1" = "--shallow" ]; then
shift
echo "Project root: $root"
julia --project=$root -e 'using Pkg; Pkg.add("HTTP")'
echo "[$(date +%T)] Further precompiling..."
julia --project=$root $root/test/precompile.jl
echo "[$(date +%T)] Precompilation done"
julia --project=$root -e 'using Pkg; Pkg.rm("HTTP")'
else
packages="unzip xvfb libgtk-3-0 libnss3 libxss1 libasound2"
apt-get update
apt-get install -y $packages
echo "Project root: $root"
julia --project=$root -e 'using Pkg; Pkg.add("Blink")'
# to find out missing dependencies:
# electron=$(julia --project=$root -e 'using Blink; println(Blink.AtomShell.electron())')
# echo $electron
# $electron
echo "[$(date +%T)] Further precompiling..."
xvfb-run julia --project=$root $root/test/precompile.jl --electron
echo "[$(date +%T)] Precompilation done"
julia --project=$root -e 'using Pkg; Pkg.rm("Blink")'
apt-get autoremove -y $packages
rm -rf /var/lib/apt/lists/*
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment