https://github.com/heiwa4126/cowsay-distroless-python
Google の distroless でマルチステージビルドの練習 (依存あり版)
https://github.com/heiwa4126/cowsay-distroless-python
distroless hatch python
Last synced: about 2 months ago
JSON representation
Google の distroless でマルチステージビルドの練習 (依存あり版)
- Host: GitHub
- URL: https://github.com/heiwa4126/cowsay-distroless-python
- Owner: heiwa4126
- Created: 2024-07-04T04:29:00.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-02-03T02:53:43.000Z (4 months ago)
- Last Synced: 2026-02-03T16:42:42.012Z (4 months ago)
- Topics: distroless, hatch, python
- Language: Python
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cowsay-distroless-python
[Google の distroless](https://github.com/GoogleContainerTools/distroless) でマルチステージビルドの練習 (依存がある版)。
ちゃんと [Hatch](https://hatch.pypa.io/latest/) でパッケージしてある。
[heiwa4126/hello-distroless-python: Google の distroless でマルチステージビルドの練習](https://github.com/heiwa4126/hello-distroless-python)
からの fork。
## Docker イメージ のビルドと実行
前提として docker と hatch が要ります。
```sh
hatch run build-docker
hatch run start-docker
```
中身は `cowsay.cow("Hello World")` が実行されるだけ。
```console
$ hatch run start-docker
___________
| Hello World |
===========
\
\
^__^
(oo)\_______
(__)\ )\/\
||----w |
|| ||
```
## 結果
```console
$ docker images cowsay-distroless
REPOSITORY TAG IMAGE ID CREATED SIZE
cowsay-distroless 0.0.2 2a2468ed2dc1 10 minutes ago 85.3MB
cowsay-distroless latest 2a2468ed2dc1 10 minutes ago 85.3MB
cowsay-distroless 0.0.1 dc00cbad4da5 About an hour ago 141MB
```
55MB ぐらい減った。
## コツ
`python3 -m cowsay_distroless` で動くように `__main__.py` を書いた。
そうしないとパスがめんどくさすぎる (`hatch run main` で確認できる)。