如何自动给 docker image 打标签? - V2EX
AaronLee

如何自动给 docker image 打标签?

  •  
  •   AaronLee Jun 13, 2023 1825 views
    This topic created in 1066 days ago, the information mentioned may be changed or developed.

    说明

    我使用 Miniflux 作为自己的 RSS 服务器,因为 PostgreSQL 对中文搜索不好,需要在 PostgreSQL 安装 Zhparser 分词插件,目前已经使用 GitHub Action 构建镜像上传到 Docker Hub ,PostgreSQL 运行良好,但也问题。

    理想状态

    GitHub Action 可以每周自动构建镜像,并上传到 Docker Hub ,如果遇到版本升级,镜像会自动新加一个标签,例子:PostgreSQL 版本为 15.3 ,镜像标签为 15-bullseye 和 15.3-bullseye ,当检测到 PostgreSQL 版本为 15.4 时,生成的镜像标签为 15-bullseye 和 15.4-bullseye ,整个过程要自动运行,不需要人工干预。

    一些探索

    进入正在运行的 PostgreSQL 容器,发现有环境变量“PG_MAJOR=15”和“PG_VERSION=15.3-1.pgdg110+1”,但不知道怎么用。

    目前解决方案

    手动查询 PostgreSQL 版本状况,有版本更新时手动处理。

    参考

    1.仓库链接 Docker Hub

    2.Dockerfile GitHub Actions

    3.amutu/zhparser

    4.fengkx/postgres-docker

    3 replies    2023-06-13 15:24:48 +08:00
    perfectlife
        1
    perfectlife  
       Jun 13, 2023
    github action 设置每天定时跑一次,去检查一下 pg 有新版本发布没有,有了就用新版本号去 sed 一下 dockerfile 里的旧版本号,然后 build ,push
    AaronLee
        2
    AaronLee  
    OP
       Jun 13, 2023
    @perfectlife 你的方案是可以,但超过我的能力范围,我现在处在照着葫芦画瓢,还不一定画的对。
    perfectlife
        3
    perfectlife  
       Jun 13, 2023
    @AaronLee 你可以用这个工具( https://github.com/docker/hub-tool ) 获取镜像 tag


    hub-tool hub-tool tag ls postgres
    TAG DIGEST STATUS LAST UPDATE LAST PUSHED LAST PULLED SIZE
    postgres:latest sha256:3f1669847a14d6a9dede99716a4256cbc08d919a712710883a0d0420aa5e957b active About an hour ago About an hour 5 minutes 1.097GB
    postgres:bullseye sha256:dcfdb5d499b04f8d0b4219b07dac07b336923a18255322c95c11d7acd7501aab active About an hour ago About an hour 5 minutes 1.097GB
    postgres:16beta1-bullseye sha256:18ebf5ef322333174bf21b4ddc2d2790ccf8ef64c7780a737aeeca8109b37d28 active About an hour ago About an hour 18 minutes 1.113GB
    postgres:16beta1 sha256:9288a8bae5d334c63b81ce201c8cff9766db4398b1b561492956aef2b2e6d9f6 active About an hour ago About an hour 18 minutes 1.113GB
    postgres:15.3-bullseye sha256:dcfdb5d499b04f8d0b4219b07dac07b336923a18255322c95c11d7acd7501aab active About an hour ago About an hour 5 minutes 1.097GB
    postgres:15.3 sha256:dcfdb5d499b04f8d0b4219b07dac07b336923a18255322c95c11d7acd7501aab active About an hour ago About an hour 5 minutes 1.097GB
    postgres:15-bullseye sha256:4f97ee9d2bee2cbb8f94be66e9bdfb64804a8f621a89d39c4dfa46c3993afbe5 active About an hour ago About an hour 5 minutes 1.097GB
    postgres:15 sha256:dcfdb5d499b04f8d0b4219b07dac07b336923a18255322c95c11d7acd7501aab active About an hour ago About an hour 5 minutes 1.097GB
    postgres:14.8-bullseye sha256:5c12a789c541307b6f5dc989107d76feb85555443c43c71be51002212f540e48 active About an hour ago About an hour 5 minutes 1.09GB
    postgres:14.8 sha256:5c12a789c541307b6f5dc989107d76feb85555443c43c71be51002212f540e48 active About an hour ago About an hour 5 minutes 1.09GB
    postgres:14-bullseye sha256:5c12a789c541307b6f5dc989107d76feb85555443c43c71be51002212f540e48 active About an hour ago About an hour 5 minutes 1.09GB
    postgres:14 sha256:5c12a789c541307b6f5dc989107d76feb85555443c43c71be51002212f540e48 active About an hour ago About an hour 5 minutes 1.09GB
    postgres:13.11-bullseye sha256:573d0dbcdde4522c6db0a0c50e4f68653c3ba1e70d081cca42d0fee87f67455f active About an hour ago About an hour 4 minutes 1.079GB
    postgres:13.11 sha256:573d0dbcdde4522c6db0a0c50e4f68653c3ba1e70d081cca42d0fee87f67455f active About an hour ago About an hour 4 minutes 1.079GB
    postgres:13-bullseye sha256:573d0dbcdde4522c6db0a0c50e4f68653c3ba1e70d081cca42d0fee87f67455f active About an hour ago About an hour 4 minutes 1.079GB
    postgres:13 sha256:573d0dbcdde4522c6db0a0c50e4f68653c3ba1e70d081cca42d0fee87f67455f active About an hour ago About an hour 4 minutes 1.079GB
    postgres:12.15-bullseye sha256:e1ddf56307e5ba4f2ea84972cba6c7c7d4a38eb877ba84d88aa6ed32c5da239d active About an hour ago About an hour 12 minutes 1.076GB
    postgres:12.15 sha256:e1ddf56307e5ba4f2ea84972cba6c7c7d4a38eb877ba84d88aa6ed32c5da239d active About an hour ago About an hour 12 minutes 1.076GB
    postgres:12-bullseye sha256:e1ddf56307e5ba4f2ea84972cba6c7c7d4a38eb877ba84d88aa6ed32c5da239d active About an hour ago About an hour 12 minutes 1.076GB
    postgres:12 sha256:e1ddf56307e5ba4f2ea84972cba6c7c7d4a38eb877ba84d88aa6ed32c5da239d active About an hour ago About an hour 12 minutes 1.076GB
    postgres:11.20-bullseye sha256:d2d7021dc4e71399876c2f427172a91c279140d99eafb2322543fc8f1dbe0c2e active 2 hours ago 2 hours 8 minutes 1.068GB
    postgres:11-bullseye sha256:d2d7021dc4e71399876c2f427172a91c279140d99eafb2322543fc8f1dbe0c2e active 2 hours ago 2 hours 8 minutes 1.068GB
    postgres:16beta1-alpine3.18 sha256:5c0c4788a82f24b5bbdfdee20bb1d2596f5df9e3557b6d62d28737a807bdb7da active 13 days ago 13 days 48 minutes 670.6MB
    postgres:16beta1-alpine3.17 sha256:ab0ab8a38bf59e9b96c2f2b2cdd2af8386fd47e9118837cfc63521db6f8fc615 active 13 days ago 13 days 18 minutes 680MB
    postgres:16beta1-alpine sha256:11def49016e5c978b95da13b4b4c60b117379e353a4c583b5a5fd873fa7f377d active 13 days ago 13 days 48 minutes 670.6MB
    postgres:alpine3.18 sha256:58a4e7ae605e8e247180ebba1cc3758ab20677e9a5221ab3150a74f47938b8a1 active 3 weeks ago 3 weeks 6 minutes 657MB
    postgres:alpine3.17 sha256:c1273693a4fa3cbd65e1c3df72b646d50368ab0bdde8a7b35446834b5fa7ff2d active 3 weeks ago 3 weeks 16 minutes 674.2MB
    postgres:alpine sha256:58a4e7ae605e8e247180ebba1cc3758ab20677e9a5221ab3150a74f47938b8a1 active 3 weeks ago 3 weeks 6 minutes 657MB
    postgres:15.3-alpine3.18 sha256:58a4e7ae605e8e247180ebba1cc3758ab20677e9a5221ab3150a74f47938b8a1 active 3 weeks ago 3 weeks 6 minutes 657MB
    postgres:15.3-alpine3.17 sha256:c1273693a4fa3cbd65e1c3df72b646d50368ab0bdde8a7b35446834b5fa7ff2
    About     Help     Advertise     Blog     API     FAQ     Solana     921 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VESION: 3.9.8.5 30ms UTC 20:35 PVG 04:35 LAX 13:35 JFK 16:35
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86