Skip to content

Commit a695dae

Browse files
authored
Merge pull request #287 from nextstrain/aws-v2
Update AWS CLI to v2
2 parents 71c6c62 + 20f2c6a commit a695dae

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

Dockerfile

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ COPY --from=xx / /
2828
# make: used for building from Makefiles (search for usage); may be used by package managers to build from source
2929
# nodejs: for installing Auspice
3030
# clang: for compiling C/C++ projects; may be used by package managers to build from source
31+
# unzip: for AWS CLI
3132
RUN apt-get update && apt-get install -y --no-install-recommends \
3233
autoconf \
3334
automake \
@@ -36,7 +37,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3637
curl \
3738
git \
3839
make \
39-
dpkg-dev
40+
dpkg-dev \
41+
unzip
4042

4143
# Install a specific Node.js version
4244
# https://github.com/nodesource/distributions/blob/ba48c1fe6e843e9ffb60aefc5da5d00234c83f04/README.md#using-debian-as-root-nodejs-20
@@ -208,6 +210,14 @@ RUN curl -fsSL https://ftp.ncbi.nlm.nih.gov/pub/datasets/command-line/v2/linux-$
208210
RUN curl -fsSL https://ftp.ncbi.nlm.nih.gov/pub/datasets/command-line/v2/linux-${TARGETARCH}/dataformat \
209211
-o /final/bin/dataformat
210212

213+
# Install tooling for our AWS Batch builds, which use `aws s3`.
214+
# Using `xx-info march` to translate amd64 -> x86_64 and arm64 -> aarch64
215+
# based on https://github.com/docker/buildx/discussions/2001
216+
RUN XX_MARCH=$(xx-info march) \
217+
&& curl -fsSL --proto '=https' "https://awscli.amazonaws.com/awscli-exe-linux-${XX_MARCH}.zip" -o "awscliv2.zip" \
218+
&& unzip awscliv2.zip "aws/dist/*" -d /final/libexec/aws-cli \
219+
&& ln -srv /final/libexec/aws-cli/aws/dist/aws /final/bin/aws
220+
211221
# ———————————————————————————————————————————————————————————————————— #
212222

213223
# Define a builder stage that runs on the target platform.
@@ -244,11 +254,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
244254
# Install envdir, which is used by pathogen builds
245255
RUN pip3 install envdir==1.0.1
246256

247-
# Install tooling for our AWS Batch builds, which use `aws s3`.
248-
RUN python3 -m venv /usr/local/libexec/awscli \
249-
&& /usr/local/libexec/awscli/bin/python -m pip install awscli==1.18.195 \
250-
&& ln -sv /usr/local/libexec/awscli/bin/aws /usr/local/bin/aws
251-
252257
# Install Snakemake and related optional dependencies.
253258
# Pinned to 9.17.0 for stability, latest guaranteed compatible version
254259
# based on <https://github.com/nextstrain/public/issues/39>
@@ -389,9 +394,6 @@ RUN chmod a+rx /usr/local/bin/* /usr/local/libexec/*
389394
# Add installed Python libs
390395
COPY --from=builder-target-platform /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
391396

392-
# AWS CLI
393-
COPY --from=builder-target-platform /usr/local/libexec/awscli/ /usr/local/libexec/awscli/
394-
395397
# Add installed Python scripts that we need.
396398
#
397399
# XXX TODO: This isn't great. It's prone to needing manual updates because it
@@ -403,7 +405,6 @@ COPY --from=builder-target-platform /usr/local/libexec/awscli/ /usr/local/libexe
403405
# -trs, 15 June 2018
404406
COPY --from=builder-target-platform \
405407
/usr/local/bin/augur \
406-
/usr/local/bin/aws \
407408
/usr/local/bin/bio \
408409
/usr/local/bin/envdir \
409410
/usr/local/bin/evofr \

tests/envdir-url.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Files are populated from NEXTSTRAIN_ENVD_URL.
2424
2525
$ aws s3 cp --quiet env.d.zip "$NEXTSTRAIN_ENVD_URL"
2626
27-
$ docker run --rm -e NEXTSTRAIN_ENVD_URL --env=AWS_{ACCESS_KEY_ID,SECRET_ACCESS_KEY,SESSION_TOKEN} "$IMAGE" \
27+
$ docker run --rm -e NEXTSTRAIN_ENVD_URL --env=AWS_{ACCESS_KEY_ID,SECRET_ACCESS_KEY,SESSION_TOKEN,DEFAULT_REGION} "$IMAGE" \
2828
> bash -eu -c 'echo "$a"; echo "$b"'
2929
download: s3://nextstrain-tmp/*.zip to ../env.d.zip (glob)
3030
Archive: /nextstrain/env.d.zip
@@ -37,7 +37,7 @@ Files are populated from NEXTSTRAIN_ENVD_URL.
3737

3838
Files and NEXTSTRAIN_ENVD_URL are removed with NEXTSTRAIN_DELETE_ENVD=1.
3939

40-
$ docker run --rm -e NEXTSTRAIN_DELETE_ENVD=1 -e NEXTSTRAIN_ENVD_URL --env=AWS_{ACCESS_KEY_ID,SECRET_ACCESS_KEY,SESSION_TOKEN} "$IMAGE" \
40+
$ docker run --rm -e NEXTSTRAIN_DELETE_ENVD=1 -e NEXTSTRAIN_ENVD_URL --env=AWS_{ACCESS_KEY_ID,SECRET_ACCESS_KEY,SESSION_TOKEN,DEFAULT_REGION} "$IMAGE" \
4141
> bash -eu -c 'echo "$a"; echo "$b"; ls -1 /nextstrain/env.d'
4242
download: s3://nextstrain-tmp/*.zip to ../env.d.zip (glob)
4343
Archive: /nextstrain/env.d.zip

0 commit comments

Comments
 (0)