Dockerfile - run, cmd, entrypoint ์ฐจ์ด

Dockerfile ์—์„œ RUN, CMD, ENTRYPOINT ์ฐจ์ด RUN - ๋„์ปค์ด๋ฏธ์ง€ ์ƒ์„ฑ์‹œ ๋™์ž‘ CMD - ๋„์ปค์ด๋ฏธ์ง€ ์‹คํ–‰์‹œ ๋™์ž‘ (๋Œ€์ฒด ๊ฐ€๋Šฅ) ENTRYPOINT - CMD์™€ ๊ฐ™์œผ๋‚˜ ์‹คํ–‰์‹œ ๋ฐ˜๋“œ์‹œ ๋™์ž‘ Dockerfile - RUN # create log script vi log-event.sh ... #!/bin/sh echo `date` $@ >> log.txt cat log.txt ... chmod u+x log-event.sh # create Docker Image vi Dockerfile ... FROM alpine ADD log-event.sh / RUN ["/log-event.sh","image created"] # ์ƒ์„ฑ์‹œ ๋™์ž‘ CMD ["/log-event.sh","container started"] # ์‹คํ–‰์‹œ ๋™์ž‘ ... docker build -t myimage . # Run Docker Image - RUN์€ ์ด๋ฏธ์ง€ ์ƒ์„ฑ์‹œ์— ๋™์ž‘ํ–ˆ์Œ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค. docker run myimage Wed Sep 27 07:10:26 UTC 2023 image created Wed Sep 27 07:36:10 UTC 2023 container started docker run myimage Wed Sep 27 07:10:26 UTC 2023 image created Wed Sep 27 07:36:21 UTC 2023 container started Dockerfile - CMD, ENTRYPOINT ์—ฌ๋Ÿฌ๊ฐœ์˜ CMD # Create Docker Image vi Dockerfile ... FROM alpine ADD log-event.sh / RUN ["/log-event.sh","image created"] # ์ƒ์„ฑ์‹œ ๋™์ž‘ CMD ["/log-event.sh","container started"] # ์‹คํ–‰์‹œ ๋™์ž‘ (๋ฌด์‹œ๋จ) CMD ["/log-event.sh","container running"] # ์‹คํ–‰์‹œ ๋™์ž‘ (๋งˆ์ง€๋ง‰CMD์ฒ˜๋ฆฌ) ... docker build -t myimage . # Run Docker Image docker run myimage Wed Sep 27 07:10:26 UTC 2023 image created Wed Sep 27 07:23:09 UTC 2023 container running CMD์™€ ENTRYPOINT # Create Docker Image vi Dockerfile ... FROM alpine ADD log-event.sh / RUN ["/log-event.sh","image created"] # ์ƒ์„ฑ์‹œ ๋™์ž‘ ENTRYPOINT ["/log-event.sh"] # ์‹คํ–‰์‹œ ๋™์ž‘ CMD ["container started"] # ์‹คํ–‰์‹œ ๋™์ž‘ ... docker build -t myimage . # Run Docker Image docker run myimage Wed Sep 27 07:10:26 UTC 2023 image created Wed Sep 27 07:23:09 UTC 2023 container started # Run Docker Image with argument docker run myimage custom event Wed Sep 27 07:10:26 UTC 2023 image created Wed Sep 27 07:24:31 UTC 2023 custom event REFERENCE Difference Between run, cmd and entrypoint in a Dockerfile - https://www.baeldung.com/ops/dockerfile-run-cmd-entrypoint Entrypoint vs cmd - https://bluese05.tistory.com/77

2023-09-27 ยท (updated 2023-10-13) ยท 298 words

Json to sqlite3 import howto

Intro jsonํŒŒ์ผ์„ sqlite3์— importํ•˜๋Š” ๋ฐฉ๋ฒ• json -> csv -> sqlite3 ์ˆœ์„œ๋กœ ์ง„ํ–‰ํ•œ๋‹ค. jq, sqlite3๊ฐ€ ์‚ฌ์ „์— ์„ค์น˜๋˜์–ด ์žˆ์–ด์•ผ ํ•œ๋‹ค. jq๋Š” ๊ฒฝ๋Ÿ‰ ๋ช…๋ น๋ผ์ธ json ๊ด€๋ฆฌ ํ”„๋กœ๊ทธ๋žจ์ด๋‹ค. Requirement $ sudo apt install sqlite3 $ sudo apt install jq Getting the CSV $ cat data.json {"uri":"/","user_agent":"example1"} {"uri":"/foobar","user_agent":"example1"} {"uri":"/","user_agent":"example2"} {"uri":"/foobar","user_agent":"example3"} $ head -1 data.json | jq -r 'keys | @csv' "uri","user_agent" $ jq -r 'map(tostring) | @csv' < data.json "/","example1" "/foobar","example1" "/","example2" "/foobar","example3" $ % (head -1 data.json | jq -r 'keys | @csv' && jq -r 'map(tostring) | @csv' < data.json) > data.csv Loading it into sqlite3 $ sqlite3 somedata.db sqlite> .mode csv sqlite> .import data.csv my_table sqlite> select * from my_table where ... Links https://stackoverflow.com/questions/46407770/how-to-convert-a-json-file-to-an-sqlite-database ...

2022-11-07 ยท 112 words

CVS to Sqlite3

Intro csv ํŒŒ์ผ์„ sqlite3 ๊ธฐ๋ณธ๊ธฐ๋Šฅ์œผ๋กœ ๋ถˆ๋Ÿฌ ํ…Œ์ด๋ธ”์— ์ €์žฅํ•  ์ˆ˜ ์žˆ๋‹ค. sqlite3์˜ interactive, command mode ์‚ฌ์šฉ๋ฒ• Howto $ cd data/ $ sqlite3 mydata.db # ์ €์žฅํ•  db๋ฅผ ์ •ํ•˜๊ณ  ์‹คํ–‰ sqlite> .mode csv # csv๋ชจ๋“œ๋กœ ์ „ํ™˜ sqlite> .import data.csv mytable # mytable ํ…Œ์ด๋ธ”๋กœ data.csv๋ฅผ ๋ณ€ํ™˜ sqlite> .dbinfo # db ์ •๋ณดํ™•์ธ sqlite> .tables # ํ…Œ์ด๋ธ” ํ™•์ธ sqlite> .schema mytable # mytable์˜ ์Šคํ‚ค๋งˆ ํ™•์ธ sqlite> .mode column # ์ปฌ๋Ÿผํ‘œ์‹œ sqlite> .headers on # ํ—ค๋”ํ‘œ์‹œ sqlite> select * from mytable where ... # ํ…Œ์ด๋ธ” ์ฟผ๋ฆฌ sqlite> .q # ์ข…๋ฃŒ $ ls -l mydata.db # DB์‚ฌ์ด์ฆˆ ํ™•์ธ ๋ช…๋ น๋ผ์ธ์—์„œ ํ™•์ธํ•  ์ˆ˜๋„ ์žˆ๋‹ค. $ sqlite3 mydata.db -header -column "select x from y;"

2022-11-07 ยท 103 words

PaperMod - Hugo Theme

TODO ์•„์ด์ฝ˜ ํ‘œ์‹œ ๋ฐ ๊ตฌ์กฐ ํŒŒ์•…ํ•ด์„œ ์ด๋ฅผ ์ ์šฉํ•˜๊ธฐ 2022-09-08 - ๋‚ด์šฉ ์ˆ˜์ •, ๊ทธ๋ฆผํŒŒ์ผ ๋งํฌ ๊ด€๋ จ ์ถ”๊ฐ€ PaperMod screen shot Intro hugo์˜ ํ…Œ๋งˆ ์ค‘์— ๊ฐ€์žฅ ๊ฐ„๊ฒฐํ•˜๊ณ  ์•ˆ์ •์ ์ด๋ฉฐ ๋งŽ์€ ์‚ฌ๋žŒ๋“ค์ด ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋‹ค. hugo ํ”„๋กœ์ ํŠธ๋Š” ~/www๋กœ ๊ฐ€์ •ํ•œ๋‹ค. ์ฃผ์˜ํ•  ๊ฒƒ์€ hugo์˜ ๊ตฌ์กฐ๊ฐ€ ~/www/contents/์ดํ•˜์— markdown ํŒŒ์ผ์„ ๋„ฃ์–ด์ฃผ์–ด์•ผ ํ•˜๊ณ , ์ดํ•˜ ํด๋”๋Š” ์ ์ ˆํžˆ ๋งŒ๋“ค๋˜ index.mdํŒŒ์ผ์€ ๋งŒ๋“ค๋ฉด ์›นํŽ˜์ด์ง€ ๋ฉ”์ธ ํ™”๋ฉด์— ๋‚ด์šฉ์ด ๋œจ์งˆ ์•Š๋Š”๋‹ค๋Š” ์ ์ด๋‹ค. ์„ค์ •์€ ~/www/config.yml์ด๋‹ค. ์„ค์ •์„ ๋ณ€๊ฒฝํ•˜๋ฉด hugo -D server ๋™์ž‘์‹œ ์ž๋™์œผ๋กœ ๋ฐ˜์˜๋œ๋‹ค. ๋งŒ์•ฝ ์„ค์ • ๋ณ€๊ฒฝ ์‚ฌํ•ญ์ด ๋ธŒ๋ผ์šฐ์ €์—์„œ ๋ณด์ด์ง€ ์•Š์œผ๋ฉด ์„œ๋ฒ„๋ฅผ ์žฌ์‹คํ–‰ ํ•œ๋‹ค. Install and Update Install $ cd ~/www $ git clone https://github.com/adityatelange/hugo-PaperMod themes/PaperMod --depth=1 Update $ cd themes/PaperMod $ git pull Setup ๊ด€๋ จ ๋งํฌ ์•„๋ž˜ ์‚ฌ์ดํŠธ์— config.yml ๋ฐ post.md ์ƒ˜ํ”Œ์ด ์žˆ์œผ๋‹ˆ ์ฐธ๊ณ ํ•œ๋‹ค. https://adityatelange.github.io/hugo-PaperMod/posts/papermod/papermod-installation/ ํ…Œ๋งˆ ์„ค์ • papermod ์˜ ํ…Œ๋งˆ๋Š” light/dark/auto ๊ฐ€ ์žˆ๋‹ค. ํ™ˆํ™”๋ฉด ์ขŒ์ธก ์ƒ๋‹จ์— ํ•ด/๋‹ฌ ์•„์ด์ฝ˜ ํด๋ฆญ baseURL: "https://your_idname.github.io/" # ์ž์‹ ์˜ ๊นƒํŽ˜์ด์ง€ URL title: My Blog and wiki # ๋ธ”๋กœ๊ทธํ™ˆ ์ œ๋ชฉ paginate: 5 # ํ™ˆ์—์„œ ๋ณด์—ฌ์ค„ ๋ธ”๋กœ๊ทธ ํ‘œ์‹œ ๊ฐฏ์ˆ˜ theme: "PaperMod" # ํ…Œ๋งˆ PaperMod๋กœ ์ง€์ • params: # defaultTheme: light # defaultTheme: light defaultTheme: auto # auto๋กœ ์„ค์ •ํ•˜๋ฉด ์‚ฌ์šฉ์ž๊ฐ€ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ๋‹ค. # disableThemeToggle: true # ํ•ด/๋‹ฌ ์•„์ด์ฝ˜์„ ๋ณด์ด์ง€ ์•Š๊ฒŒ ํ•˜๊ธฐ ๋ฉ”๋‰ด์„ค์ • ํ™ˆ ์šฐ์ธก ์ƒ๋‹จ ๋ฉ”๋‰ด๋ฅผ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ถ”๊ฐ€ํ•œ๋‹ค. menu: main: - identifier: categories # ๋ธ”๋กœ๊ทธ ์นดํ…Œ๊ณ ๋ฆฌ ๋ฉ”๋‰ด name: categories url: /categories/ weight: 10 - identifier: search # ๋ธ”๋กœ๊ทธ ๊ฒ€์ƒ‰ ๋ฉ”๋‰ด name: Search url: /search weight: 30 - identifier: tags # ๋ธ”๋กœ๊ทธ ํƒœ๊ทธ ๋ฉ”๋‰ด name: tags url: /tags/ weight: 20 - identifier: archives # ๋ธ”๋กœ๊ทธ ํƒœ๊ทธ ๋ฉ”๋‰ด name: tags url: /tags/ weight: 20 Archive Page - ์•„์นด์ด๋ธŒ ํŽ˜์ด์ง€, ๋‚ ์งœ๋ณ„๋กœ ์˜ฌ๋ฆฐ ํฌ์ŠคํŠธ๋ฌธ์„œ๊ฐ€ ์ •๋ฆฌ๋จ $ cat << EOF > ~/www/content/archives.md --- title: "Archive" layout: "archives" # url: "/archives" summary: "archives" --- EOF Search Page - ๊ฒ€์ƒ‰ํŽ˜์ด์ง€, ํผ์ง€ ์Šคํƒ€์ผ์˜ ๋น ๋ฅธ ๊ฒ€์ƒ‰ $ cat << EOF > ~/www/content/search.md --- title: "Search" # in any language you want layout: "search" # is necessary # url: "/archive" # description: "Description for Search" summary: "search" placeholder: "๊ฒ€์ƒ‰์–ด๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”" --- EOF tags์™€ categories๋Š” ์˜ฌ๋ฆด ํฌ์ŠคํŠธ๋ฌธ์„œ post.md ๋“ฑ์˜ frontmatter์— ๊ธฐ๋กํ•˜๋ฉด ์ž๋™์œผ๋กœ ๋ถ„๋ฅ˜๋˜๊ณ  ํ™ˆ ์ƒ๋‹จ ๋ฉ”๋‰ด์—์„œ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. Post Cover Image ~/www/config.yml์— ์„ค์ •ํ•ด์ฃผ๊ณ  ์•„๋ž˜ ์„ค๋ช…๋Œ€๋กœ ํฌ์ŠคํŠธ๋ฌธ์„œ์— ๋งํฌ๋ฅผ ๊ฑธ์–ด์ฃผ๋ฉด ๋œ๋‹ค. cover: image: "<image path/url>" # can also paste direct link from external site # ex. https://i.ibb.co/K0HVPBd/paper-mod-profilemode.png alt: "<alt text>" caption: "<text>" relative: false # To use relative path for cover image, used in hugo Page-bundles ์ด๋ฏธ์ง€ ์‚ฌ์ด์ฆˆ๋ฅผ ์ค„์ด๊ณ  ์ฒ˜๋ฆฌ์†๋„๋ฅผ ๋†’์ด๋ ค๋ฉด ์•„๋ž˜ ์„ค์ • ์ถ”๊ฐ€ params: cover: responsiveImages: false ๊ทธ๋Ÿฌ๋‚˜ ์‹ค์ œ๋กœ ์ ์šฉํ•ด๋„ ํŽ˜์ด์ง€๋Š” ๋ณ€ํ™”ํ•˜์ง€ ์•Š๋Š”๋‹ค. ...

2022-08-24 ยท (updated 2025-06-15) ยท 701 words

PaperMod - Hugo Theme

History 2025-06-27 - tip ์ถ”๊ฐ€: tags, categories list์— cover image ํ‘œ์‹œํ•˜๊ธฐ 2022-09-08 - ๋‚ด์šฉ ์ˆ˜์ •, ๊ทธ๋ฆผํŒŒ์ผ ๋งํฌ ๊ด€๋ จ ์ถ”๊ฐ€ PaperMod screen shot Intro hugo์˜ ํ…Œ๋งˆ ์ค‘์— ๊ฐ€์žฅ ๊ฐ„๊ฒฐํ•˜๊ณ  ์•ˆ์ •์ ์ด๋ฉฐ ๋งŽ์€ ์‚ฌ๋žŒ๋“ค์ด ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋‹ค. hugo ํ”„๋กœ์ ํŠธ๋Š” ~/www๋กœ ๊ฐ€์ •ํ•œ๋‹ค. ์ฃผ์˜ํ•  ๊ฒƒ์€ hugo์˜ ๊ตฌ์กฐ๊ฐ€ ~/www/contents/์ดํ•˜์— markdown ํŒŒ์ผ์„ ๋„ฃ์–ด์ฃผ์–ด์•ผ ํ•˜๊ณ , ์ดํ•˜ ํด๋”๋Š” ์ ์ ˆํžˆ ๋งŒ๋“ค๋˜ index.mdํŒŒ์ผ์€ ๋งŒ๋“ค๋ฉด ์›นํŽ˜์ด์ง€ ๋ฉ”์ธ ํ™”๋ฉด์— ๋‚ด์šฉ์ด ๋œจ์งˆ ์•Š๋Š”๋‹ค๋Š” ์ ์ด๋‹ค. ์„ค์ •์€ ~/www/config.yml์ด๋‹ค. ์„ค์ •์„ ๋ณ€๊ฒฝํ•˜๋ฉด hugo -D server ๋™์ž‘์‹œ ์ž๋™์œผ๋กœ ๋ฐ˜์˜๋œ๋‹ค. ๋งŒ์•ฝ ์„ค์ • ๋ณ€๊ฒฝ ์‚ฌํ•ญ์ด ๋ธŒ๋ผ์šฐ์ €์—์„œ ๋ณด์ด์ง€ ์•Š์œผ๋ฉด ์„œ๋ฒ„๋ฅผ ์žฌ์‹คํ–‰ ํ•œ๋‹ค. Install and Update Install $ cd ~/www $ git clone https://github.com/adityatelange/hugo-PaperMod themes/PaperMod --depth=1 Update $ cd themes/PaperMod $ git pull Setup ๊ด€๋ จ ๋งํฌ ์•„๋ž˜ ์‚ฌ์ดํŠธ์— config.yml ๋ฐ post.md ์ƒ˜ํ”Œ์ด ์žˆ์œผ๋‹ˆ ์ฐธ๊ณ ํ•œ๋‹ค. https://adityatelange.github.io/hugo-PaperMod/posts/papermod/papermod-installation/ ํ…Œ๋งˆ ์„ค์ • papermod ์˜ ํ…Œ๋งˆ๋Š” light/dark/auto ๊ฐ€ ์žˆ๋‹ค. ํ™ˆํ™”๋ฉด ์ขŒ์ธก ์ƒ๋‹จ์— ํ•ด/๋‹ฌ ์•„์ด์ฝ˜ ํด๋ฆญ baseURL: "https://your_idname.github.io/" # ์ž์‹ ์˜ ๊นƒํŽ˜์ด์ง€ URL title: My Blog and wiki # ๋ธ”๋กœ๊ทธํ™ˆ ์ œ๋ชฉ paginate: 5 # ํ™ˆ์—์„œ ๋ณด์—ฌ์ค„ ๋ธ”๋กœ๊ทธ ํ‘œ์‹œ ๊ฐฏ์ˆ˜ theme: "PaperMod" # ํ…Œ๋งˆ PaperMod๋กœ ์ง€์ • params: # defaultTheme: light # defaultTheme: light defaultTheme: auto # auto๋กœ ์„ค์ •ํ•˜๋ฉด ์‚ฌ์šฉ์ž๊ฐ€ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ๋‹ค. # disableThemeToggle: true # ํ•ด/๋‹ฌ ์•„์ด์ฝ˜์„ ๋ณด์ด์ง€ ์•Š๊ฒŒ ํ•˜๊ธฐ ๋ฉ”๋‰ด์„ค์ • ํ™ˆ ์šฐ์ธก ์ƒ๋‹จ ๋ฉ”๋‰ด๋ฅผ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ถ”๊ฐ€ํ•œ๋‹ค. menu: main: - identifier: categories # ๋ธ”๋กœ๊ทธ ์นดํ…Œ๊ณ ๋ฆฌ ๋ฉ”๋‰ด name: categories url: /categories/ weight: 10 - identifier: search # ๋ธ”๋กœ๊ทธ ๊ฒ€์ƒ‰ ๋ฉ”๋‰ด name: Search url: /search weight: 30 - identifier: tags # ๋ธ”๋กœ๊ทธ ํƒœ๊ทธ ๋ฉ”๋‰ด name: tags url: /tags/ weight: 20 - identifier: archives # ๋ธ”๋กœ๊ทธ ํƒœ๊ทธ ๋ฉ”๋‰ด name: tags url: /tags/ weight: 20 Archive Page - ์•„์นด์ด๋ธŒ ํŽ˜์ด์ง€, ๋‚ ์งœ๋ณ„๋กœ ์˜ฌ๋ฆฐ ํฌ์ŠคํŠธ๋ฌธ์„œ๊ฐ€ ์ •๋ฆฌ๋จ $ cat << EOF > ~/www/content/archives.md --- title: "Archive" layout: "archives" # url: "/archives" summary: "archives" --- EOF Search Page - ๊ฒ€์ƒ‰ํŽ˜์ด์ง€, ํผ์ง€ ์Šคํƒ€์ผ์˜ ๋น ๋ฅธ ๊ฒ€์ƒ‰ $ cat << EOF > ~/www/content/search.md --- title: "Search" # in any language you want layout: "search" # is necessary # url: "/archive" # description: "Description for Search" summary: "search" placeholder: "๊ฒ€์ƒ‰์–ด๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”" --- EOF tags์™€ categories๋Š” ์˜ฌ๋ฆด ํฌ์ŠคํŠธ๋ฌธ์„œ post.md ๋“ฑ์˜ frontmatter์— ๊ธฐ๋กํ•˜๋ฉด ์ž๋™์œผ๋กœ ๋ถ„๋ฅ˜๋˜๊ณ  ํ™ˆ ์ƒ๋‹จ ๋ฉ”๋‰ด์—์„œ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. Post Cover Image ~/www/config.yml์— ์„ค์ •ํ•ด์ฃผ๊ณ  ์•„๋ž˜ ์„ค๋ช…๋Œ€๋กœ ํฌ์ŠคํŠธ๋ฌธ์„œ์— ๋งํฌ๋ฅผ ๊ฑธ์–ด์ฃผ๋ฉด ๋œ๋‹ค. cover: image: "<image path/url>" # can also paste direct link from external site # ex. https://i.ibb.co/K0HVPBd/paper-mod-profilemode.png alt: "<alt text>" caption: "<text>" relative: false # To use relative path for cover image, used in hugo Page-bundles ์ด๋ฏธ์ง€ ์‚ฌ์ด์ฆˆ๋ฅผ ์ค„์ด๊ณ  ์ฒ˜๋ฆฌ์†๋„๋ฅผ ๋†’์ด๋ ค๋ฉด ์•„๋ž˜ ์„ค์ • ์ถ”๊ฐ€ params: cover: responsiveImages: false ๊ทธ๋Ÿฌ๋‚˜ ์‹ค์ œ๋กœ ์ ์šฉํ•ด๋„ ํŽ˜์ด์ง€๋Š” ๋ณ€ํ™”ํ•˜์ง€ ์•Š๋Š”๋‹ค. ...

2022-08-24 ยท (updated 2025-06-27) ยท 864 words