Docker Image - Mass Auto Update
Not sure how others deal with 100s+ images, but this is how I do it.
Purpose
As more and more packages are made into docker images, keeping them up to date become a tedious task.
Some images just pull package without specifying version and update means rebuilding them blindly. And there is no version info from image tag.
Auto_Docker intend to ease this burden, at least for simple docker images that depends on single package. It can update Dockerfile, README.md, apply git commit and tag according to new version.
Features
- Update project
- Dockerfile
- README.md
- LICENSE
- Dry run
- Try build
- Update DB
- Alpine
- Auto git commit
- Auto git tag
A framework for automatically updating simple docker project.
Usage
|
|
|
|
Example directory tree:
|
|
Update db:
|
|
Process 1 docker project docker_amule
:
Test run only …
|
|
Save …
|
|
Git commit too …
|
|
Process all docker projects docker_
, use -prefix
:
Test run only …
|
|
Use -project
to specify single project
Use prefix
to specify projects with common path prefix
Multiple -project
and -prefix
can be used together.
Workflow
Generate DB
|
|
When -updatedb
is used. All ${auto_distro_root}/<distro>/${auto_db_script}
will be executed. Each will generate a ${auto_data_root}/db/<distro>/${auto_db_data}
.
With default configuration, related file structure as follow:
|
|
Distro
debian
script is not available now.
Staging
A docker project is being copied under staging area ${auto_stg_root} before being process. All changes will be applied there.
|
|
Projects are copied into ${auto_stg_root}
:
|
|
If new package version is found, Dockerfile
will be updated and a testing docker build
will be performed.
docker build
test can be skipped with -nobuild
.
As long as
-save
is not used, nothing will change in the original project folder. It is advice to inspect the staging files before using the-save
option.
Save
-save
option will copy Dockerfile
, LICENSE
and README.md
back to original project folder.
Commit
-commit
will commit with new package version. Only has effect with -save
.
|
|
Tag
-tag
will tag with new package version. Only has effect with -commit
.
|
|
What Is Being Updated
Dockerfile
Take following Dockerfile
as example:
|
|
Package name is taken from name
label.
Package version is taken from version
label.
They are then compare with distro db. If new version is found, the version will be update accordingly, including version line 8.
maintainer
and usage
will also be updated if they are available.
README.md
Take following README.md
as example:
|
|
If version is updated to 0.74.0
, new lines will be automatically added before <!--CHANGE-LOG-END-->
as follow:
|
|
If there copyright line as follow:
|
|
It will be updated with current year:
|
|
License
LICENSE
file, if there copyright line as follow:
|
|
It will be updated with current year:
|
|
Limitation
- Distro
- Only alpine:latest and alpine:edge are supported now.
- Dockerfile
name
label must be same as package name.version
label must be same as package version.
Distro and DB
The ${auto_distro_root}/<distro>
directory provide a way to extend support for more distro.
db.sh ${auto_db_script}
db.sh
of each distro should start with following:
|
|
db.sh
only task is to produce db.data
at ${_db_path}
.
distro.conf
|
|
db.data ${auto_db_data}
db.sh
create db.data
in following format:
|
|
Example:
|
|
Repository
Contributors
Change Log
- 0.9
- Base features completed
- README.md completed
- 1.0
- Add auto clear stage
- Add option nobuild
- Clean up
- Fix commit and tag version
- Fix sed inline for MacOS
- Rename auto.sh -> auto_docker
- Update to use #!/usr/bin/env bash
- Update usage
License
The MIT License
Copyright (c) 2020
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.