ããã«ã¡ã¯ã ã¨ããµã¤ãæ ªå¼ä¼ç¤¾ã®ä¸æµ¦ã§ãã
ã³ã³ããã§ã®éçºãããéãã§ããã ããµã¤ãºãæ¸ãããããAlpine Linuxï¼ä»¥éAlpineï¼ã使ã£ã¦ããæ¹ãå¤ãã¨æãã¾ãã
ã§ããAlpineã¯ããµã¤ãºãæ¸ããããã«ããã©ã«ãã§ã¯ curl
ã³ãã³ããå
¥ã£ã¦ãã¾ããã
ãã®ãããä¾ãã°APIã®ãã«ã¹ãã§ãã¯ã®ããã® curl
ã使ã£ãã¨ã³ããã¤ã³ãã¸ã®ã¢ã¯ã»ã¹ã¯ãå°ãªãã¨ãããã©ã«ããã®ã¾ã¾ã§ã¯åºæ¥ãªãã¨ãããã¨ã«ãªãã¾ãã
ä»åã¯ã Alpineã使ã£ã¦ããå ´åã®ãAPIã®ã¨ã³ããã¤ã³ãã¸ã®ãã«ã¹ãã§ãã¯ã®ããã®ã¢ã¯ã»ã¹æ¹æ³ã説æãã¾ãã
æ¹æ³1ï¼curlãã¤ã³ã¹ãã¼ã«ãã
1ã¤ãã®æ¹æ³ã¯ãã·ã³ãã«ã« curl
ãã¤ã³ã¹ãã¼ã«ããã¨ãããã®ã§ãã
FROM ***-alpine RUN apk update \ && apk add --upgrade curl
ããããã°ããã¨ã¯é常éã curl
ã§ãã«ã¹ãã§ãã¯å¯è½ã§ãã
curl -f http://localhost/health/path || exit 1
æ¹æ³2ï¼wgetã使ç¨ãã
2ã¤ãã¯ã wget
ã使ç¨ããæ¹æ³ã§ãã
Alpineã¯ã curl
ã¯ããã©ã«ãã§ã¯å
¥ã£ã¦ãã¾ããã wget
ã¯å
¥ã£ã¦ããã®ã§ããããæ´»ç¨ãã¾ãã
wget --quiet --spider http://localhost/health/path || exit 1
-q -O
ãªãã·ã§ã³ã使ãæ¹æ³ãããããã§ãã
ç¹ã« curl
ãä»ã§ä½¿ãå¿
è¦æ§ãç¡ãã®ã§ããã°ãããã©ã«ãã§å
¥ã£ã¦ãããã® wget
ã使ã£ãæ¹æ³ã®æ¹ããæéãããããè¯ãã®ã§ã¯ãªãã§ããããã
æå¾ã«
Alpineãªã©ãã³ã³ãããµã¤ãºãå°ãããªãããã«ä½ã£ã¦ãããã®ã¯ããã®æ§è³ªä¸æ®æ®µä½¿ããã¦ããã³ãã³ããç¡ããã¨ãããã¾ãã
ä»åã®ããã«ä»£æ¿æ¡ãè¦ã¤ããããã©ããããããªãå ´åã¯èªåã§ã¤ã³ã¹ãã¼ã«ãã¾ãããã