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

#5950 Pulling up user creation in Dockerfile for layer caching #6002

Merged
merged 1 commit into from
Dec 8, 2019

Conversation

gunnarmorling
Copy link
Contributor

@gunnarmorling gunnarmorling commented Dec 7, 2019

In case of rebuilding an image, the create user command would run again before, as it came after the more volatile commands for adding dependencies and runner.

Fixes: #5950

@gunnarmorling
Copy link
Contributor Author

Not sure how to test this. I did the change first in an actual project and can confirm it works there. But of course I could have messed up when transferring the change into the template. Is there an easy way I can materialize the template again so to see whether it's working correctly?

Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a minor comment, looks good otherwise

@geoand
Copy link
Contributor

geoand commented Dec 7, 2019

You can test the new templates by generating a project according to what has been documented in at: 4dec5b8

@gunnarmorling
Copy link
Contributor Author

gunnarmorling commented Dec 7, 2019 via email

@geoand
Copy link
Contributor

geoand commented Dec 7, 2019

Great, thanks!

@gsmet
Copy link
Member

gsmet commented Dec 7, 2019

It's minor but it the second time you do it IIRC: could we avoid the ; at the end of the commit line?

Thanks.

@gsmet gsmet changed the title #5950 Pulling up user creation in Dockerfile for layer caching; #5950 Pulling up user creation in Dockerfile for layer caching Dec 7, 2019
@gunnarmorling
Copy link
Contributor Author

gunnarmorling commented Dec 7, 2019 via email

@gsmet
Copy link
Member

gsmet commented Dec 7, 2019

Well, it won't work very well in a project with 200 committers and you're the only one doing it :).

Let's get rid of it.

In case of rebuilding an image, the create user command would run again before, as it came after the more volatile commands for adding dependencies and runner.
@gunnarmorling
Copy link
Contributor Author

Well, it won't work very well in a project with 200 committers and you're the only one doing it :)

Obviously, the 199 others should do as I do ;) Until then, I've removed it.

Also tested the snapshot template version as suggested by @geoand. All looks good, here's the log showing how the ADD USER command is cached after a code change:

docker build -f src/main/docker/Dockerfile.jvm -t quarkus/quarkus-5950-jvm .
Sending build context to Docker daemon   9.39MB
Step 1/9 : FROM fabric8/java-alpine-openjdk8-jre:1.6.5
 ---> e169b1c71a87
Step 2/9 : ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
 ---> Using cache
 ---> 4cfb18e98d5a
Step 3/9 : ENV AB_ENABLED=jmx_exporter
 ---> Using cache
 ---> b227b10c9fef
Step 4/9 : RUN adduser -G root --no-create-home --disabled-password 1001   && chown -R 1001 /deployments   && chmod -R "g+rwX" /deployments   && chown -R 1001:root /deployments
 ---> Using cache
 ---> c8df6ada7d35
Step 5/9 : COPY target/lib/* /deployments/lib/
 ---> Using cache
 ---> 74f113b90ada
Step 6/9 : COPY target/*-runner.jar /deployments/app.jar
 ---> 1c0d783686e1
Step 7/9 : EXPOSE 8080
 ---> Running in 97d37ce8db03
Removing intermediate container 97d37ce8db03
 ---> 33a63879c6da
Step 8/9 : USER 1001
 ---> Running in 2d1977e3716e
Removing intermediate container 2d1977e3716e
 ---> dd5f8b4d9566
Step 9/9 : ENTRYPOINT [ "/deployments/run-java.sh" ]
 ---> Running in b57a6bfc8fb9
Removing intermediate container b57a6bfc8fb9
 ---> b48b92145535
Successfully built b48b92145535
Successfully tagged quarkus/quarkus-5950-jvm:latest

Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gunnarmorling!!!

@geoand
Copy link
Contributor

geoand commented Dec 8, 2019

@gsmet do you plan on backporting this one?

@gsmet
Copy link
Member

gsmet commented Dec 8, 2019

I haven't created the branch yet tbh.

If you think that's something we should have in 1.1, let's merge it once CI is green.

@geoand geoand added this to the 1.1.0 milestone Dec 8, 2019
@gsmet gsmet merged commit 90b88e0 into quarkusio:master Dec 8, 2019
@gsmet
Copy link
Member

gsmet commented Dec 8, 2019

Merged, thanks.

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

Successfully merging this pull request may close these issues.

Pull up adduser in Dockerfile.jvm
3 participants