Raychaser
Raychaser

Reputation: 370

Microservice with long build time in Docker

We have an in-house c++ tool that we are investigating as a docker microservice and wondering if it's even a good idea.

The issue is that the tool has a lot of dependencies including GDAL which can take 30 minutes to download and compile.

Normally my provisioning steps would look like:

  1. git clone gdal
  2. ./configure; make; make install;
  3. git clone myTool
  4. make myTool

My question is how should I approach this problem using docker? I can just put "RUN" statements in my Dockerfile but then it takes a long time to build containers and each one is 600MB+. I'd like to know if there's a better way.

Upvotes: 1

Views: 214

Answers (1)

Erik Dannenberg
Erik Dannenberg

Reputation: 6086

Create a separate base image for gdal then base your final images on that. This way you rarely have to rebuild gdal.

As for image size, there is currently no clean way to distinguish build and runtime dependencies of an docker image. At work we resorted to some bash glue that essentially enables nested docker builds. For further details on that you can check out this repo.

Upvotes: 2

Related Questions