- Yair Mark
My Dockerfiles typically look like the following:
FROM gradle:jdk11 AS builder WORKDIR /home/root/ COPY . . RUN gradle build -x test
The key point to notice is the
COPY . . line which copies everything under the docker build context.
This is typically the root of the project being built. To optimize this process typically a
.dockerignore is used which includes any files that docker must ignore when creating the build context.
Today I ran into an issue where I was trying to get a new
Dockerfile working but every time I made a change to the
Dockerfile and nowhere else, the entire image was rebuilt. Dockerfiles are normally in the root of the project it belongs to and
COPY . . copies the root of said project. It turns out I did not have my Dockerfile in the .dockerignore. As soon as I added it changes to the Dockerfile did not result in a full image rebuild - only the modified lines caused a partial rebuild.