Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Docker: multi-stage multi-environment

Docker: multi-stage multi-environment

Talk given on Unconference Track in LaraconEU 2018

Abdala Cerqueira

August 31, 2018
Tweet

More Decks by Abdala Cerqueira

Other Decks in Technology

Transcript

  1. Problem 1 • Keep different Dockerfiles per environment • !

    dev tools and dependencies on production
  2. Problem 2 • Big, huge, immense images • One or

    two commands may leave images out of control
  3. Checklist • Have only one Dockerfile • Use the same

    Dockerfile for all environments (dev, test, prod) • Create small images • Manage less dependencies
  4. Official PHP image • One Dockerfile • All environments •

    Small images • Less dependencies Time: ~39s Size: 430MB Security problems
  5. Official PHP image multi-stage • One Dockerfile • All environments

    • Small images • Less dependencies Time: ~40s Size: 393MB Not that small, hidden dependencies
  6. Alpine image • One Dockerfile • All environments • Small

    images • Less dependencies Time: ~11s Size: 59.4MB Still have unwanted dependencies
  7. Alpine image multi-stage • One Dockerfile • All environments •

    Small images • Less dependencies Time: ~16s Size: 35.8MB This is ART <3
  8. Comparison table Image Time Size alpine:3.8 - 4.41 MB php:7.2-apache

    - 377 MB laravel-apache 39s 430 MB laravel-apache-multi 40s 393 MB laravel-alpine 11s 59.4 MB laravel-alpine-multi 16s 35.8 MB