Docker Community Forums

Share and learn in the Docker community.

Simplify large build with multiple images


(Jsolbrig) #1

I’m new to Docker and a little confused on how to handle large builds that use multiple dockerfiles to create multiple dependent images. Maybe I am going about this all wrong. While I have tried to make my question as clear as I can, it still may not be clear. Sorry if it is not.

I currently have a setup that builds many different dependencies in four different docker files. Each dockerfile builds upon the previous. Below I give a general idea of what the different dockerfiles do. I know that what I have below won’t create slim images, but this is just for testing so far and I will slim them down later.

At this point, any advice on how to better make use of Docker and how to construct more useful images would be appreciated.

centos7_dev_env:
    from centos:7
    install via yum: 
        "Core"
        "Base" 
        "Development Tools"

development_env:
    from centos7_dev_env:some_version
    installs via yum: 
        zlib-dev
        openssl-devel
        openmp
        libjpeg-turbo-devel
        ncurses-devel
        geos-devel
        bzip2-devel
        sqlite-devel
        tkinter
        tk-devel
        python-tkinter
        python-devel
        netcdf-devel
    from source:
        Python 3.7
        Pip

dev_env_with_python:
    from development_env:some_version
    install a bunch of packages via pip
    install some python packages from source
    install some environment configuration

dev_package:
    from dev_env_with_python:some_version
    install my actual code

ops_package:
    from dev_package:some_version
    create entrypoint