Fetchy可用于构建具有所需最小依赖关系的最小docker镜像

网友投稿 621 2022-11-03

Fetchy可用于构建具有所需最小依赖关系的最小docker镜像

Fetchy可用于构建具有所需最小依赖关系的最小docker镜像

Fetchy - Minuscule images made trivial

Why Fetchy?

Fetchy can be used to build minimal docker images with the minimal set of dependencies required, significantly reducing the size of your Docker images.

Fetchy will make it incredibly easy to build your docker images. Simply using the CLI fetchy dockerize . Try it!

Furthermore, it is possible to customize the operating system, architecture and operating system version to fetch the latest (secure) packages from a package mirror.

How does Fetchy work?

Fetchy works by downloading debian / ubuntu packages based on some parameter you supply Fetchy. For example, if you tell fetchy to use ubuntu as a distribution and bionic as its version and download python Fetchy will look for available packages under python and download the packages required to run python. Then, if tasked to do so, Fetchy will extract the files of all the packages and wrap them in a Docker image.

Fetchy will try to slim down the image by inspecting dependencies and remove /include packages as it sees fit.

Backlog

Currently the following features are being worked on:

Direct installation of package through urlSupport redhat's archiveEasy exclusions and inclusions of filesInteractive management of packagesStability fixes

Does Fetchy have any effect on my system?

A folder will be created under ~/.cache for caching. Or, if specified under $XDG_CACHE_HOME.

Installing

Fetchy can be installed by running the following command:

Any of:

pip3 install fetchy

pip install fetchy

python3 -m pip install fetchy

Examples

Some existing images can be found here https://github.com/ThomasKluiters/fetchy-images

Fetchy can be used as a command line utility, though, it also offers an API.

Create a minimal docker image for a python environment based on your current operating system and architecture.

fetchy dockerize python

You can specify multiple packages:

fetchy dockerize python3.6 postgresql

If you want to build a docker image based on another operating system (debian stretch in this example), this is also possible:

fetchy dockerize --distribution debian --version stretch openssl

Blueprints

You can also use blueprints to build images:

architecture: amd64base: scratchcodename: bionicdistribution: ubuntupackages: exclude: - debconf fetch: - pythontag: builder

Call fetchy with:

fetchy blueprint blueprint.yml

Advanced features

Excluding dependencies

If some packages are unwanted, you can simply exclude them:

Using a name:

fetchy dockerize --exclude dpkg --exclude perl-base python3

It is also possible to create an exclusion file, where each line denotes a dependency that should not be included:

exclusions.txt

perl-basedpkg

Using a name:

fetchy dockerize -exclude exclusions.txt python3

Note: exclusion files MUST end with a .txt extension!

Using PPA's

If some packages are not available for your main mirror, try using a ppa:

Using a name:

fetchy dockerize --ppa deadsnakes/ppa python3.8

Using a URL:

fetchy dockerize --ppa https://deb.nodesource.com/node_10.x nodejs

Or both!

fetchy dockerize --ppa https://deb.nodesource.com/node_10.x --ppa deadsnakes/ppa python3.8 nodejs

Developing

Fetchy uses poetry to build all sources and collect all requirements. The project can be set up through the following sequence of commands:

pip install poetrygit clone https://github.com/ThomasKluiters/fetchycd fetchypoetry installpoetry shell

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:基于小说精品屋-plus构建的Spring Cloud 微服务小说门户平台
下一篇:基于springboot的兼职工作平台的设计与实现
相关文章

 发表评论

暂时没有评论,来抢沙发吧~