{"id":19208544,"url":"https://github.com/heiwa4126/hello-distroless-python","last_synced_at":"2026-05-18T15:02:59.102Z","repository":{"id":247504218,"uuid":"823915108","full_name":"heiwa4126/hello-distroless-python","owner":"heiwa4126","description":"Google の distroless でマルチステージビルドの練習","archived":false,"fork":false,"pushed_at":"2024-10-14T17:10:58.000Z","size":12,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-04T15:49:36.830Z","etag":null,"topics":["distroless","docker","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heiwa4126.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-04T02:13:00.000Z","updated_at":"2024-07-09T01:23:15.000Z","dependencies_parsed_at":"2024-07-09T05:08:03.004Z","dependency_job_id":"45f9aaa9-5095-440a-8f85-49ea28c6680e","html_url":"https://github.com/heiwa4126/hello-distroless-python","commit_stats":null,"previous_names":["heiwa4126/hello-distroless-python"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fhello-distroless-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fhello-distroless-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fhello-distroless-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fhello-distroless-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heiwa4126","download_url":"https://codeload.github.com/heiwa4126/hello-distroless-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240280989,"owners_count":19776418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distroless","docker","python3"],"created_at":"2024-11-09T13:26:56.455Z","updated_at":"2026-05-18T15:02:59.085Z","avatar_url":"https://github.com/heiwa4126.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hello-distroless\n\nGoogle の distroless でマルチステージビルドの練習。\n\n- [distroless/examples/python3 at main · GoogleContainerTools/distroless](https://github.com/GoogleContainerTools/distroless/tree/main/examples/python3)\n- via [distroless/python3/README.md at main · GoogleContainerTools/distroless](https://github.com/GoogleContainerTools/distroless/blob/main/python3/README.md)\n- via [GoogleContainerTools/distroless: 🥑 Language focused docker images, minus the operating system.](https://github.com/GoogleContainerTools/distroless/tree/main)\n\nで、一番上のリンクから `Dockerfile` と `hello.py` をコピーしてきたもの。\n\n## ビルド\n\n```sh\ndocker build . -t hello-distroless\ndocker run --rm hello-distroless\n```\n\nで /etc の下のファイルが再帰的にリスト表示される。\n\n## メモ\n\nローカルでは\n\n```sh\npython3 hello.py .\n# または\n./hello.py .\n```\n\nのように実行する。distroless の Docker 上では shebang は見てない。そもそも shell がない。なので書き換えてもいいかもね。\n→ 書き換えました\n\nイメージのサイズは\n\n```console\n$ docker images hello-distroless\n\nREPOSITORY         TAG       IMAGE ID       CREATED              SIZE\nhello-distroless   latest    17244fa00d1a   About a minute ago   52.8MB\n```\n\nなので確かに `python:3-slim` よりは 100MB 以上小さい。\n\n`gcr.io/distroless/python3:nonroot-amd64` では\n\n- Python のバージョン - `3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]`\n- Python のフルパス - `/usr/bin/python3.11`\n- ライブラリパス - `['/app', '/usr/lib/python311.zip', '/usr/lib/python3.11', '/usr/lib/python3.11/lib-dynload']`\n\nでした(2024-07 現在)。ライブラリパスに cwd が入るらしい。\n\nよくわからないのが\n「どうやってこのスクリプトが起動してるのか」。あたかも `python hello.py /etc` みたいに起動してるけど。まあそういうものなのだろう。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheiwa4126%2Fhello-distroless-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheiwa4126%2Fhello-distroless-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheiwa4126%2Fhello-distroless-python/lists"}