Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use docker-compose build for dynamic containers, allow easier container config #1560

Merged
merged 14 commits into from
May 6, 2019

Conversation

rfay
Copy link
Member

@rfay rfay commented Apr 30, 2019

The Problem/Issue/Bug:

  • Our web container gets bigger and bigger
  • Users will always have new requests for containers, or for extra config

How this PR Solves The Problem:

  • Uses docker-compose up --build, so that a build context can be added for dynamic containers
  • If .ddev/db-build/Dockerfile or .ddev/web-build/Dockerfile exists, the Dockerfile there will be used to build the web or db image.
  • config.yaml webimage_extra_packages and dbimage_extra_packages allow just adding debian packages without writing a Dockerfile.
  • See the docs

TODO:

  • Allow a simple list of packages to add in config.yaml
  • docs
  • .ddev/*-build/Dockerfile.example should be gitignored
  • Add config commands for *_extra_packages

Manual Testing Instructions:

  • Create a .ddev/web-build/Dockerfile with these contents:
ARG BASE_IMAGE=drud/ddev-webserver:latest
FROM $BASE_IMAGE
RUN touch /var/tmp/this-was-from
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y php7.3-yaml
  • ddev start

  • You should find on ddev ssh that php7.3-yaml is installed

  • Do the same thing for db-build (with a different package or action)

Automated Testing Overview:

  • Test webimage_extra_packages and dbimage_extra_packages
  • Test to make sure Dockerfile overrides webimage_extra_packages
  • Test behavior of Dockerfile

Related Issue Link(s):

Release/Deployment notes:

@rfay rfay self-assigned this Apr 30, 2019
@rfay rfay added this to the v1.8.0 milestone May 1, 2019
@rfay rfay force-pushed the 20190430_use_build_for_dynamic_containers branch from fc915fc to 99b499e Compare May 1, 2019 17:35
@rfay rfay removed the needs docs label May 1, 2019
@rfay rfay force-pushed the 20190430_use_build_for_dynamic_containers branch from 23d1fed to a04396f Compare May 1, 2019 22:37
@rfay rfay force-pushed the 20190430_use_build_for_dynamic_containers branch from a04396f to 01f108d Compare May 2, 2019 20:38
@rfay rfay marked this pull request as ready for review May 2, 2019 20:40
@rfay rfay requested a review from andrewfrench May 2, 2019 20:40
Copy link
Contributor

@andrewfrench andrewfrench left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very interesting, and I expect this will be used as a more robust replacement for complex pre-start hook configurations? I think it's a great and pretty powerful idea and I'm interested in seeing how people end up using this.

While testing, I confirmed that I could define a Dockerfile used to extend both the ddev-webserver and ddev-dbserver containers, build them on start, and confirm that the customizations made in the custom Dockerfile were present in the container using ddev ssh.

@rfay rfay force-pushed the 20190430_use_build_for_dynamic_containers branch from d3d75c7 to 6f51787 Compare May 3, 2019 18:59
@rfay rfay merged commit 70917c6 into ddev:master May 6, 2019
@rfay rfay mentioned this pull request May 9, 2019
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants