Closed devopsadmin-james closed 4 years ago
Use -P
Use -P= to pass parameters to gradle tasks
could you help me to clarify it more? I still have no idea how to pass build args to dockerfile
In Dockerfile, I defined ARG Token In gradle task, I add -PToken but it didn't work
ah, figured it out
How to pass build arguments to one of a below gradleTask (Say dockertest) to below Dockerfile from gradle command line like "gradle dockertest -Pbimage=test.jar" is it possilbe like we pass through docker cli "docker build --build-args bimage=test.jar"
FROM openjdk:8-jre
VOLUME /tmp ARG bimage ADD $bimage java.jar
RUN bash -c 'touch /java.jar'
EXPOSE 8080
task dockertest(type: Docker, dependsOn: build) { push = false tag = 'test/java' tagVersion = "${ver}" dockerfile = file('src/main/docker/Dockerfile') buildArgs = "${bimage}" doFirst { copy { from "build/libs/'${image}'" into 'build/docker' } } }