avkcode / **container-tools ** Public

构建更好的基础镜像

License

MIT license 30 stars 1 fork Branches Tags Activity

avkcode/container-tools

main BranchesTags Go to file Code

Folders and files

Name| Name| Last commit message| Last commit date
---|---|---|---

Latest commit

History

24 Commits
debian| debian
recipes| recipes
scripts| scripts
.gitignore| .gitignore
Dockerfile| Dockerfile
LICENSE| LICENSE
Makefile| Makefile
README.md| README.md
Vagrantfile| Vagrantfile
favicon.svg| favicon.svg
tools.mk| tools.mk
View all files

Repository files navigation

Container Tools

Container Tools | Container Tools 是一个项目,它提供脚本和实用程序,以使用 debootstrap 自动化创建最小的基于 Debian 的根文件系统 (rootfs)。它支持使用特定包、配置进行自定义,并集成容器化环境的安全扫描。可以很容易地扩展到其他发行版和项目。
---|---

Rational

当使用标准 Dockerfile 构建容器化环境时,每个自定义层都会创建:

使用此工具可以构建:

How it works:

Usage: make <target>
 ============================
 ** Debian Linux targets **
 ============================
|all|
|debian11|
|debian11-java|
|debian11-java-slim|
|debian11-corretto|
|debian11-graal|
|debian11-graal-slim|
|debian11-java-slim-maven|
|debian11-java-slim-gradle|
|debian11-graal-slim-maven|
|debian11-graal-slim-gradle|
|debian11-java-kafka|
|debian11-java-slim-kafka|

In the end it will produce the image

[Image was built successfully]
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Artifact location: debian/dist/debian11-graal-slim/debian11-graal-slim.tar
Artifact size: 124M
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Image was built successfully!
Artifact location: debian/dist/debian11-graal-slim/debian11-graal-slim.tar
To load and run this Docker image, follow these steps:
Load the Docker image from the .tar file:
  cat debian/dist/debian11-graal-slim/debian11-graal-slim.tar | docker import - debian/dist/debian11-graal-slim/debian11-graal-slim
Verify the image was loaded successfully:
  docker images
Run the Docker container:
  docker run -it <IMAGE_NAME>
  Replace <IMAGE_NAME> with the name of the image loaded in the first step.
Example:
  docker run -it debian/dist/debian11-graal-slim/debian11-graal-slim /bin/bash
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Time elapsed: 193

How to extend

  1. Add recipe to recipes/
  2. Make sure that the link to artifact and SHA256 is correct (e.g sha256sum kafka_2.13-4.0.0.tgz):
KAFKA_VERSION='4.0.0'
KAFKA_SHA='7b852e938bc09de10cd96eca3755258c7d25fb89dbdd76305717607e1835e2aa'
KAFKA_URL="https://downloads.apache.org/kafka/${KAFKA_VERSION}/kafka_2.13-${KAFKA_VERSION}.tgz"
  1. Add target to the Makefile
debian11-java-slim-kafka:
	$(PRINT_HEADER)
	$(DEBIAN_BUILD_SCRIPT) \
			--name=$@ \
			--keyring=$(DEBIAN_KEYRING) \
			--variant=container \
			--release=stable \
			--recipes=$(JAVA_RECIPES)/java_slim.sh,$(RECIPES)/kafka/kafka.sh \
			--scripts=$(SCRIPTS)/security-scan.sh

Profit

Repository Directory Structure

Root Directory

debian/

包含用于镜像构建的 Debian 特定的文件

debian/debootstrap/

不同 Debian 版本的配置文件:

debian/keys/

用于包验证的 GPG 密钥:

Key Files:

recipes/

包含用于不同组件的安装脚本

recipes/java/

Java 相关的安装脚本:

recipes/kafka/

scripts/

构建后维护脚本:

dist/

输出目录(在构建期间创建):

download/

临时下载目录(在构建期间创建):

About

Build better base images

Resources

Readme

License

MIT license Activity

Stars

30 stars

Watchers

1 watching

Forks

1 fork

Releases

No releases published

Packages 0

No packages published

Languages