From c05f4d667e148be080ea7417980ecd661a9b2192 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Fri, 14 Oct 2022 17:15:07 +0000 Subject: [PATCH 1/3] Simplify builder-scripts/ COPY command There's no need to list every script since all should be used in the Dockerfile now, following 3d45a6160e1cbe32c83b286545fdfc63a6541ba3. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index efe513fe..a465e999 100644 --- a/Dockerfile +++ b/Dockerfile @@ -155,8 +155,8 @@ RUN curl -fsSL -o /final/bin/nextalign2 https://github.com/nextstrain/nextclade/ RUN curl -fsSL -o /final/bin/nextclade2 https://github.com/nextstrain/nextclade/releases/latest/download/nextclade-x86_64-unknown-linux-gnu \ && ln -sv nextclade2 /final/bin/nextclade -# Add helpers for build -COPY builder-scripts/download-repo builder-scripts/latest-augur-release-tag /builder-scripts/ +# Add helper scripts +COPY builder-scripts/ /builder-scripts/ # Fauna RUN /builder-scripts/download-repo https://github.com/nextstrain/fauna master /nextstrain/fauna From c9d1bcaaed81766c281c0214ed0d5d94dbf2f250 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Fri, 14 Oct 2022 17:17:27 +0000 Subject: [PATCH 2/3] Move builder-scripts/ COPY command Move the command before Nextclade downloads since it is a "setup" step. This keeps download commands closer to each other, and allows Nextclade download commands to use scripts if needed in the future. --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index a465e999..d31e934e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -142,6 +142,9 @@ RUN pip3 install git+https://github.com/cov-lineages/pango-designation.git@19d9a # docker build --build-arg CACHE_DATE="$(date)" ARG CACHE_DATE +# Add helper scripts +COPY builder-scripts/ /builder-scripts/ + # Nextclade/Nextalign v2 are downloaded directly but using the latest version, # so they belong after CACHE_DATE (unlike Nextclade/Nextalign v1). @@ -155,9 +158,6 @@ RUN curl -fsSL -o /final/bin/nextalign2 https://github.com/nextstrain/nextclade/ RUN curl -fsSL -o /final/bin/nextclade2 https://github.com/nextstrain/nextclade/releases/latest/download/nextclade-x86_64-unknown-linux-gnu \ && ln -sv nextclade2 /final/bin/nextclade -# Add helper scripts -COPY builder-scripts/ /builder-scripts/ - # Fauna RUN /builder-scripts/download-repo https://github.com/nextstrain/fauna master /nextstrain/fauna From 218e0453d3fef90652a8c8ebcec0ca8b4cb870cf Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Mon, 17 Oct 2022 17:51:31 +0000 Subject: [PATCH 3/3] Consolidate repo download with later usage This mirrors the existing pattern of WORKDIR+RUN for each tool in the "build from source" section. Also makes it easier to move things around if needed. --- Dockerfile | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index d31e934e..850b0fdc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -159,32 +159,31 @@ RUN curl -fsSL -o /final/bin/nextclade2 https://github.com/nextstrain/nextclade/ && ln -sv nextclade2 /final/bin/nextclade # Fauna -RUN /builder-scripts/download-repo https://github.com/nextstrain/fauna master /nextstrain/fauna +WORKDIR /nextstrain/fauna +RUN /builder-scripts/download-repo https://github.com/nextstrain/fauna master . \ + && pip3 install --requirement=requirements.txt # Augur -RUN /builder-scripts/download-repo https://github.com/nextstrain/augur "$(/builder-scripts/latest-augur-release-tag)" /nextstrain/augur - -# Auspice -RUN /builder-scripts/download-repo https://github.com/nextstrain/auspice release /nextstrain/auspice - -# Install Fauna deps -RUN pip3 install --requirement=/nextstrain/fauna/requirements.txt - # Augur is an editable install so we can overlay the augur version in the image # with --volume=.../augur:/nextstrain/augur and still have it globally # accessible and importable. -RUN pip3 install --editable "/nextstrain/augur" +WORKDIR /nextstrain/augur +RUN /builder-scripts/download-repo https://github.com/nextstrain/augur "$(/builder-scripts/latest-augur-release-tag)" . \ + && pip3 install --editable . # pysam (for ncov/Pangolin) RUN pip3 install pysam +# Auspice # Install Node deps, build Auspice, and link it into the global search path. A # fresh install is only ~40 seconds, so we're not worrying about caching these # as we did the Python deps. Building auspice means we can run it without # hot-reloading, which is time-consuming and generally unnecessary in the # container image. Linking is equivalent to an editable Python install and # used for the same reasons described above. -RUN cd /nextstrain/auspice && npm update && npm install && npm run build && npm link +WORKDIR /nextstrain/auspice +RUN /builder-scripts/download-repo https://github.com/nextstrain/auspice release . \ + && npm update && npm install && npm run build && npm link # ———————————————————————————————————————————————————————————————————— #