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

Automate build system #1428

Closed
wants to merge 22 commits into from
Closed

Automate build system #1428

wants to merge 22 commits into from

Conversation

smlx
Copy link
Member

@smlx smlx commented Nov 22, 2019

Checklist

  • Affected Issues have been mentioned in the Closing issues section
  • Documentation has been written/updated.
  • Changelog entry has been written

The idea behind this change is that the image names are already encoded in directory names, and build dependencies between images are already defined in the Dockerfiles themselves. So let's parse that information to generate build targets and dependencies automatically, and avoid the error-prone process of manual Makefile editing. These generated make rules are then written to .docker.mk, which is included in the main Makefile. This will generate a build:<name> target for each image.

Note that this new system doesn't touch any files like the existing build system, but docker image caching is pretty fast - a second run of make build:all -j$(getconf _NPROCESSORS_ONLN) takes <20s on my system.

Here are the new commands:

help                                 Display this help section
minishift/start                      Create and start local minishift cluster, and configure for Lagoon
build:s3-save                        Save container images to S3
build:s3-load                        Load container images from S3
build:push-minishift                 Push any available built images to the local minishift registry
publish:amazeeio-baseimages          Push base images to the amazeeio org on docker hub
publish:amazeeiolagoon-baseimages    Push base images to the amazeeiolagoon org on docker hub
publish:amazeeiolagoon-serviceimages Push service images to the amazeeio org on docker hub
build:all                            Build all lagoon images
build:list                           List all image build targets
build:pull                           Pull all third-party images that Lagoon bases its images on, and write report to pull-report.json

Most of these are functionally identical to the targets they replace, but there are a few new ones..

  • The old minishift target is now split into minishift and minishift/start. This is done becaues the former actually creates a ./minishift file which is a dependency of other targets. The latter does the actual configuration of minishift for local lagoon development.
  • build:pull pulls all the base images that lagoon builds on into the local docker image cache, and generates a pull-report.json containing the image names/tags and hashes of these base images. This could be published as a release artefact to make it easier to know exactly which image versions make up a lagoon release.
  • help (the default target) prints a simple display of the major Makefile commands.

I've also made some small changes to simplify the layout of the lagoon images, consolidating Dockerfiles where possible (e.g. php, ELK). The layout could probably be simplified further, which would then allow further simplification of the build scripts.

Changelog Entry

Improvement - automate build system

Closing issues

Closes #981, #1376, #1482, #1499.
Supersedes #982.

@tobybellwood tobybellwood added the 6-images-testing Base Images & Testing subsystem label Dec 18, 2019
@smlx smlx force-pushed the auto-build-system branch 8 times, most recently from 96602d8 to 9a13a8c Compare December 19, 2019 07:34
@smlx smlx force-pushed the auto-build-system branch 2 times, most recently from 952f7f6 to e81a9e8 Compare January 2, 2020 08:06
@tobybellwood
Copy link
Member

I really like this.

Looking at the section used to build multi-version images, we can probably look to extend that a little to additionally specify the alpine version for backwards compatibility

PHP_VERSIONS := 5.6 7.0 7.1 7.2 7.3 7.4
NODE_VERSIONS := 6 8 9 10 12
PYTHON_VERSIONS := 3.7
SOLR_VERSIONS := 5.5 6.6 7.5

We'd need an elegant way to add an ALPINE_VERSION to correspond to specific PHP/NODE/PYTHON etc versions - this could be part of a different piece of work to pin image versions better and avoid suprises

PYTHON_VERSIONS := 2.7|3.10 3.7|3.11

@smlx smlx force-pushed the auto-build-system branch 3 times, most recently from cd47540 to 18de419 Compare January 7, 2020 01:35
@smlx
Copy link
Member Author

smlx commented Jan 13, 2020

I've split these PRs out of this branch for easier merging: #1503, #1516, #1520, #1524, #1525, #1526

Once those are in I'll rebase on master and this one should be ready to review.

@smlx smlx force-pushed the auto-build-system branch 4 times, most recently from 0f1e480 to 5734463 Compare January 22, 2020 01:05
@smlx smlx marked this pull request as ready for review January 22, 2020 06:24
@smlx smlx mentioned this pull request Jan 22, 2020
3 tasks
@smlx smlx force-pushed the auto-build-system branch 5 times, most recently from e083c8f to 8eb2fbd Compare April 9, 2020 11:43
The effective version of the previous build-dep was 7.3
Simplify the build by reusing the same variable name.
* use BASE_VERSION
* add versions to pecl extensions, as recommended upstream
Avoid build/* and recursive make.
@smlx smlx marked this pull request as draft April 16, 2020 13:38
@smlx
Copy link
Member Author

smlx commented Oct 2, 2020

Closing this since I think it's been superseded by https://github.com/uselagoon/lagoon-images

@smlx smlx closed this Oct 2, 2020
@smlx smlx deleted the auto-build-system branch October 2, 2020 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6-images-testing Base Images & Testing subsystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build process is slow
2 participants