Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching Gradle in Docker layer #65

Closed
zommerfelds opened this issue Mar 22, 2022 · 1 comment
Closed

Caching Gradle in Docker layer #65

zommerfelds opened this issue Mar 22, 2022 · 1 comment

Comments

@zommerfelds
Copy link
Contributor

Hi, sorry to ask this here but I don't know where this would better fit.

I use this repo to build my Android APK using Cordova. When I iterate and modify some files I have to spend significant time waiting for the following steps:

#34 13.09 Subproject Path: CordovaLib
#34 13.09 Subproject Path: app
#34 13.31 Downloading https://services.gradle.org/distributions/gradle-7.1.1-all.zip
#34 14.26 ...................................................................................................................................................
#34 34.93 Unzipping /root/.gradle/wrapper/dists/gradle-7.1.1-all/1wqbeia0d49252rmlcr6o8lbl/gradle-7.1.1-all.zip to /root/.gradle/wrapper/dists/gradle-7.1.1-all/1wqbeia0d49252rmlcr6o8lbl
#34 38.01 Set executable permissions for: /root/.gradle/wrapper/dists/gradle-7.1.1-all/1wqbeia0d49252rmlcr6o8lbl/gradle-7.1.1/bin/gradle
#34 38.54
#34 38.54 Welcome to Gradle 7.1.1!
#34 38.54
#34 38.54 Here are the highlights of this release:
#34 38.55  - Faster incremental Java compilation
#34 38.55  - Easier source set configuration in the Kotlin DSL
#34 38.55
#34 38.55 For more details see https://docs.gradle.org/7.1.1/release-notes.html
#34 38.55
#34 38.73 Starting a Gradle Daemon (subsequent builds will be faster)
#34 118.2 > Task :app:preBuild UP-TO-DATE

Is it possible to somehow run these steps at the beginning of my Dockerfile? I'm not sure if the downloaded graddle version depends on my project. But ideally I'm looking for something like:

FROM beevelop/cordova:v2021.02.1
RUN gradle-prepare-and-run-daemon

# Run all the actual build steps
COPY ...
RUN cordova build android

But I don't know if Cordova exposes this kind of option. Any pointers would be appreciated!

@beevelop
Copy link
Owner

Quite late to the party, but the most recent version should rely on Gradle 7.1.1 by default and downloads Gradle in the Docker build step: https://github.com/beevelop/docker-cordova/actions/runs/4736470174/jobs/8408053686#step:8:853

I'm not 💯 sure, if the layer is cached and persisted for later builds, but happy to get feedback (as I'm not using this image actively anymore). 🙏 Feel free to reopen, if the issue persist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants