-
François LAURENT authoredFrançois LAURENT authored
Dockerfile 3.62 KiB
FROM julia:1.10.9-bullseye AS base
ARG BRANCH=main
ENV JULIA_PROJECT=/app \
JULIA_DEPOT_PATH=/usr/local/share/julia
RUN apt-get update \
&& apt-get install --no-install-recommends -y git \
&& rm -rf /var/lib/apt/lists/* \
&& git clone --depth 1 --no-tags --single-branch -b $BRANCH https://gitlab.pasteur.fr/nyx/larvatagger.jl "$JULIA_PROJECT" \
&& rm -rf "$JULIA_PROJECT/.git" \
&& julia -e 'using Pkg; try Pkg.rm("TaggingBackends"); catch end; Pkg.instantiate()' \
&& ln -s "$JULIA_PROJECT/scripts/larvatagger" /bin \
&& mkdir -p "$JULIA_DEPOT_PATH/logs" && rm -f "$JULIA_DEPOT_PATH/logs/manifest_usage.toml" && ln -s /dev/null "$JULIA_DEPOT_PATH/logs/manifest_usage.toml"
# RUN $JULIA_PROJECT/test/precompile.sh --shallow \
# && mv larvatagger.so /lib/ \
# && rm -rf $JULIA_PROJECT/test/data
ENTRYPOINT ["/app/scripts/larvatagger"]
#, "-J/lib/larvatagger.so"]
FROM base AS prebuild
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VERSION=1.8.3
RUN apt-get update \
&& apt-get install --no-install-recommends -y python3-dev python3-pip \
&& rm -rf /var/lib/apt/lists/* \
&& pip install "poetry==$POETRY_VERSION"
FROM prebuild AS backend
ARG PROJECT_DIR=/app
ARG TAGGINGBACKENDS_BRANCH=main
ARG BACKEND
RUN if [ -z $TAGGINGBACKENDS_BRANCH ]; then \
TAGGINGBACKENDS_BRANCH=dev; \
fi; \
if [ "$BACKEND" = "MaggotUBA/20221005-1" ]; then \
cd /app \
&& julia -e "using Pkg; Pkg.add(url=\"https://gitlab.pasteur.fr/nyx/TaggingBackends\", rev=\"$TAGGINGBACKENDS_BRANCH\")" \
&& git clone --depth 1 --no-tags --single-branch -b 20221005 https://gitlab.pasteur.fr/nyx/MaggotUBA-adapter MaggotUBA \
&& cd MaggotUBA \
&& rm -rf .git \
&& rm -rf models/20221005 \
&& poetry install --only main \
&& poetry add "pynvml==11.4.1" \
&& rm -rf ~/.cache; \
elif [ "$BACKEND" = "MaggotUBA/20221228" ]; then \
cd /app \
&& julia -e "using Pkg; Pkg.add(url=\"https://gitlab.pasteur.fr/nyx/TaggingBackends\", rev=\"$TAGGINGBACKENDS_BRANCH\")" \
&& git clone --depth 1 --no-tags --single-branch -b dev https://gitlab.pasteur.fr/nyx/MaggotUBA-adapter MaggotUBA \
&& cd MaggotUBA \
&& rm -rf .git \
&& poetry install --only main \
&& poetry add "pynvml==11.4.1" \
&& apt-get update \
&& apt-get install --no-install-recommends -y wget \
&& mkdir -p models \
&& cd models \
&& wget -O- https://gitlab.pasteur.fr/nyx/artefacts/-/raw/master/MaggotUBA/20221228.tar.gz?inline=false | tar zxv \
&& apt-get autoremove -y wget \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf ~/.cache; \
elif [ "$(echo $BACKEND | cut -d/ -f1)" = "MaggotUBA" ]; then \
cd /app \
&& julia -e "using Pkg; Pkg.add(url=\"https://gitlab.pasteur.fr/nyx/TaggingBackends\", rev=\"$TAGGINGBACKENDS_BRANCH\")" \
&& git clone --depth 1 --no-tags --single-branch -b $(echo $BACKEND | cut -d/ -f2) https://gitlab.pasteur.fr/nyx/MaggotUBA-adapter MaggotUBA \
&& cd MaggotUBA \
&& rm -rf .git \
&& (cat requirements.txt | xargs -I % sh -c 'poetry add "%"') \
&& poetry install --only main \
&& poetry add "pynvml==11.4.1" \
&& if [ "$(echo $BACKEND | cut -d/ -f2)" = "main" ] || [ "$(echo $BACKEND | cut -d/ -f2)" = "dev" ]; then \
julia -e 'using Pkg; Pkg.add("JSON3")' \
&& scripts/make_models.jl default \
&& cd /app \
&& recipes/patch.sh; \
fi \
&& rm -rf ~/.cache; \
fi
COPY recipes/checkgpu /bin/
FROM backend AS confusion
ARG PYTHON_ENV=/app/MaggotUBA
RUN test -d $PYTHON_ENV \
&& cd $PYTHON_ENV \
&& poetry add "scikit-learn==1.3.0" \
&& rm -rf ~/.cache
ADD https://gitlab.pasteur.fr/nyx/TaggingBackends/-/raw/dev/scripts/confusion.py?ref_type=heads&inline=false /bin/confusion.py