Skip to content

Commit aa834af

Browse files
authored
Update Dockerfile to cache gradle binary (#4095)
## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here --> ## Description <!--- Describe your changes in detail --> ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [ ] For changes to the smithy-rs codegen or runtime crates, I have created a changelog entry Markdown file in the `.changelog` directory, specifying "client," "server," or both in the `applies_to` key. - [ ] For changes to the AWS SDK, generated SDK code, or SDK runtime crates, I have created a changelog entry Markdown file in the `.changelog` directory, specifying "aws-sdk-rust" in the `applies_to` key. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent 62b04eb commit aa834af

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tools/ci-build/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ ARG rust_nightly_version
2828
ENV RUSTUP_HOME=/opt/rustup \
2929
CARGO_HOME=/opt/cargo \
3030
PATH=/opt/cargo/bin/:${PATH} \
31-
CARGO_INCREMENTAL=0
31+
CARGO_INCREMENTAL=0 \
32+
JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto.x86_64 \
33+
GRADLE_USER_HOME=/home/build/.gradle
34+
3235
WORKDIR /root
3336
RUN yum -y install --allowerasing \
3437
autoconf \
@@ -40,6 +43,7 @@ RUN yum -y install --allowerasing \
4043
gcc \
4144
gcc-c++ \
4245
git \
46+
java-17-amazon-corretto-headless \
4347
make \
4448
openssl-devel \
4549
perl \
@@ -83,6 +87,8 @@ RUN set -eux; \
8387
git clone https://github.com/smithy-lang/smithy-rs.git; \
8488
cd smithy-rs; \
8589
git checkout ${smithy_rs_commit_hash}; \
90+
# Run the gradle wrapper with no args to download the gradle binary and cache it in the image
91+
./gradlew; \
8692
fi; \
8793
cargo install --locked --path tools/ci-build/changelogger; \
8894
cargo install --locked --path tools/ci-build/crate-hasher; \
@@ -197,8 +203,6 @@ ENV PATH=$PATH:/usr/local/musl/bin/
197203
ENV PATH=/opt/cargo/bin:$PATH \
198204
CARGO_HOME=/opt/cargo \
199205
RUSTUP_HOME=/opt/rustup \
200-
JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto.x86_64 \
201-
GRADLE_USER_HOME=/home/build/.gradle \
202206
RUST_STABLE_VERSION=${rust_stable_version} \
203207
RUST_NIGHTLY_VERSION=${rust_nightly_version} \
204208
CARGO_INCREMENTAL=0 \
@@ -212,8 +216,8 @@ ENV PATH=/opt/cargo/bin:$PATH \
212216
ENV SMITHY_RS_DOCKER_BUILD_IMAGE=1
213217
RUN pip3 install --no-cache-dir mypy==0.991
214218
WORKDIR /home/build
215-
COPY sanity-test /home/build/sanity-test
216219
# RUSTUP_TOOLCHAIN takes precedence over everything except `+<toolchain>` args. This will allow us to ignore the toolchain
217220
# file during CI, avoiding issues during Rust version upgrades.
218221
ENV RUSTUP_TOOLCHAIN=${rust_stable_version}
222+
COPY sanity-test /home/build/sanity-test
219223
RUN /home/build/sanity-test

0 commit comments

Comments
 (0)