ååã®ã¨ã³ããªã§ä½ã£ã Docker ã¤ã¡ã¼ã¸ motemen/datastore-emulator ã¯ãgoogle/cloud-sdk ããã¼ã¹ã«ãã¦ãããããã®ãã¼ã¹ã¤ã¡ã¼ã¸ããã£ãããªé »åº¦ã§æ´æ°ããããã¨ãããèªåã¯ãã®è¿½å¾ã«æãç ©ãããæ°ã¯ãªãã¦ãå ¨é¨èªåã§ãã£ã¦ã»ããã
ããããã£ããã¨
- google/cloud-sdk:x.y.z ããªãªã¼ã¹ããããã
- ãªãã¸ããªä¸ã® ./Dockerfile 㨠./alpine/Dockerfile ã® FROM ã google/cloud-sdk:x.y.z(-alpine) ã«æ´æ°ãã
- x.y.z ã¿ã°ãæã£ã¦ git push ãããã¨ã§ã
- Docker Hub ã« x.y.z(-alpine) ã¿ã°ã¨ãã¦ãªãªã¼ã¹ãã
ãããèªåãã¤ç¡æã§å®ç¾ãããã
æ¡ç¨ããªãã£ãæ¡: èªåã§ãªããä½ã
ã¯ããã¯é©å½ãª GitHub Actions ãããããã¦ãDocker Hub ã®ã¤ã¡ã¼ã¸æ´æ°ãæ¤åºãããã¨ãããã¨ãããã¤ããã ã£ãã
æ´æ°ãã£ã¼ãã Docker Hub ãåãã¦ãããã°â¦â¦ã¨èãã¦ãããã©ãã¤ã¡ã¼ã¸ã¯æ¥ä»ãæ°ãããã°ããã¨ãããã®ã§ã¯ãªãã*-slim
ã¿ãããªããªã¨ã¼ã·ã§ã³ããã以ä¸ãã¿ã°ããã¼ã¸ã§ã³ã¨ãã¦è§£éãã¦é©åãªãã®ãé¸æãããã¨ããªãã¦ã¯ãããªããããã°ã§ããããªãã ãã©ãDockerflie ã®å
¬å¼ãªãã¼ã¶ããªãã®ã¯ããã¯ã ã£ãããããçç±ãããªããã ãã©ããã®æ¡ã¯ä¸æ¡ç¨ããã£ã¨æ¥½ãªæ¹æ³ããã£ãããã ã
Renovate ã使ã
ããããã§èª¬æããã£ããåç¶ãªãã ãã©ãæè¿è©¦ãã¦æ°ã«å ¥ã£ã¦ãã Renovate ã Dockerfile ã®æ´æ°ã«å¯¾å¿ãã¦ããã®ã§ãããã使ããç°¡åã«è¨ãã¨ãä¾åé¢ä¿ãæ´æ°ãã Pull Request ãä½ã£ã¦ããããã¤ã§ãã
Whitesource Renovate - Automated Dependency Updates
Dockerfile ãç½®ãããªãã¸ããªã«ã¤ãã¦ãRenovate ãè¨å®ããã°åæã«æ´æ°ãè¦ã¤ãã¦ãã«ãªã¯ãã¦ãããã
docker:enableMajor
ã¨ãããDockerfile ã§ã¡ã¸ã£ã¼ãã¼ã¸ã§ã³ã®æ´æ°ãæå¹ã«ãã preset ãå¹ãã¦ããªãã£ãä¸å
·åããã£ãã®ã ãã©ãã¤ãæè¿è§£æ¶ããã¾ããã
ã¡ãªã¿ã« Dependabot ã Dockerfile ã®æ´æ°ã«å¯¾å¿ãã¦ããããè¤æ°ã® Dockerfile ã®æ´æ°ãã²ã¨ã¤ã® PR ã§å¦çãããã¨ããã®ãã§ããªããããªã®ã§ä»åã¯ããããªãã£ããä»ã®çç±ããã£ã¦ Renovate ã®ã»ãã好ã¿ã ã¨ããã®ãããã
èªåãã¼ã¸ãæå¹ã«ããããã«ãã¹ãæ¸ã
Renovate ã«ã¯ automerge
ã¨ããè¨å®é
ç®ããã£ã¦ãããã使ãã¨ï¼CI ãéã£ããã¨ã«ï¼PR ãèªåãã¼ã¸ããã£ã¦ãã¨ãã§ãããCI ããã¾ãæ§æããã°ãã³ãºããªã¼ã§éç¨ã§ãããã ãã¨ããããã§ä»¥ä¸ã®ãããªãã¹ããæ¸ãã
- å
¨ã¦ã® Dockerfile ããã¼ã¹ã¤ã¡ã¼ã¸ã®åããã¼ã¸ã§ã³ã«åºã¥ãã¦ãããã¨
./Dockerfile
ãFROM foo:1.2.3
ã§./alpine/Dockerfile
ãFROM foo:2.0.0-alpine
ã ã£ãããã¾ã
- ããããã® Dockerfile ãæ£ããæ´¾çã¤ã¡ã¼ã¸ã«ãªã£ã¦ãããã¨
./alpine/Dockerfile
ã¯*-alpine
ã¿ãããªã¿ã°ã«ãªã£ã¦ããã¨ãã¨ãããã¨
ããããããã¹ãããã¹ã¯ãªãããæ¸ãã¦ãGitHub Actions ãä»è¾¼ããFROM
ã®è§£æã¯ä»¥ä¸ã®ãããªéãªã¯ã³ã©ã¤ãã¼ã§ãè¶ãæ¿ãã¦ããã
perl -nle 'print "$1\t$2\t$3" if /^FROM (\S+?):([0-9.]+)(?:-([^:-]+))?(?:$| )/' "$@"
ãã¾ãåãã¦ãã¼ã¸ããã Pull Request ããã¡ãã§ãããã®ã¨ã³ããªãæ¸ãããã«æ¢ãã¾ã§ããã¼ã¸ã§ã³ãä¸ãã£ã¦ããã¨ã«æ°ã¥ããªãã£ãã®ã§æåã§ããã
ã¿ã°ãæã¤
æå¾ã«ãmaster ã«ãã¼ã¸ãããã Dockerfile ããã¼ã¹ã« git tag ãæã¡ããããããªã¬ã« Docker Hub ã§ãã«ããããã
ãããå ã»ã©ã®éãªã¯ã³ã©ã¤ãã¼ã使ã£ã¦ããããªæãã«ãããGitHub Actions ã® checkout@v2 ã§ããã°ç¹ã«è¨å®ãªã㧠git push ã§ãã¡ããã®ã§ã便å©ã
https://github.com/motemen/docker-datastore-emulator/blob/8aed69b/.github/workflows/tag.yml#L17-L23
tag=$(./scripts/parse-dockerfile-from Dockerfile | cut -f2) echo "tag: $tag" if ! git rev-parse --quiet --verify "refs/tags/$tag" > /dev/null; then git tag "$tag" git push --tags fi
ãããã§ãããï¼ ãããå ¨é¨ç¡æã§å®ç¾ã§ãã¦ããã ãªãã¦ããã£ããèªåã¯åä¸ã§ã©ããªåè¡ãç©ãã§ãããã â¦â¦ã¨ãã®ã®ãã°ããã§ããä»çã§ãããã°ãããã§ããã