API Service - Long build of Docker image even after small changes

daniel_adornes
Level 3
API Service - Long build of Docker image even after small changes
Hey Dataiku team!
 
I noticed that my deployments of API Service take a long time rebuilding many layers of the Docker image even after small changes made to my endpoints.
I wonder if DSS applies the changes to some part at the beginning of the Dockerfile (under the hood) causing all the Docker layers to be rebuilt (even those that might be very standard).
 
Ideally, small changes should reflect only in the final steps of the Docker image, avoiding all previous steps being rebuilt unnecessarily, which would make the Docker build command much faster and also decrease considerably the disk usage for Docker images.
 
Of course, as it happens under the hood, I'm not sure this is really what is happening, but if it is, I would raise this improvement suggestion.
0 Kudos
1 Reply
HarizoR
Developer Advocate

Hi Daniel,

You are correct, the final image of your deployment is not rebuilt from scratch every time, instead it relies on a common base image to build on top of. 

That being said, multiple things happen when you click on the "Deploy" button :

- first, an updated image of your API service is built,

- then, this image is pushed to the container registry configured for your Infrastructure,

- finally, the Kubernetes deployment itself is updated, meaning that the updated image is pulled from the container registry and the pods of your deployments are spawned. Depending on the number of replicas in your Kubernetes deployment, this can take some time.

All in all, the build step is probably not where the bottleneck is, you may be able to pinpoint it more precisely by looking at the timestamps of each step in the backend logs.

Hope this helps.

Best,

Harizo

0 Kudos