Skip to content

Commit

Permalink
Docs - Pulling up info on .dockerignore
Browse files Browse the repository at this point in the history
In particular Maven users may miss that section about updating their .dockerignore file for in-container builds, which only are shown after the example Dockerfile for Gradle. By pulling this information before the two example Dockerfiles, everyone should read them.
  • Loading branch information
gunnarmorling authored Nov 27, 2022
1 parent 3fc0563 commit a26196c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/src/main/asciidoc/building-native-image.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,12 @@ That approach is possible with a multi-stage Docker build:
1. The first stage builds the native executable using Maven or Gradle
2. The second stage is a minimal image copying the produced native executable


[WARNING]
====
Before building a container image from the Dockerfiles shown below, you need to update the default `.dockerignore` file, as it filters everything except the `target` directory. In order to build inside a container, you need to copy the `src` directory. Thus, edit your `.dockerignore` and remove the `*` line.
====

Such a multi-stage build can be achieved as follows:

Sample Dockerfile for building with Maven:
Expand Down Expand Up @@ -591,11 +597,6 @@ CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

If you are using Gradle in your project, you can use this sample Dockerfile. Save it in `src/main/docker/Dockerfile.multistage`.

[WARNING]
====
Before launching our Docker build, we need to update the default `.dockerignore` file as it filters everything except the `target` directory. As we plan to build inside a container, we need to copy the `src` directory. Thus, edit your `.dockerignore` and update the content.
====

[source,bash]
----
docker build -f src/main/docker/Dockerfile.multistage -t quarkus-quickstart/getting-started .
Expand Down

0 comments on commit a26196c

Please sign in to comment.