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

Graphic Card - ๊ทธ๋ž˜ํ”ฝ์นด๋“œ

Nvidia Quadro 5000 ์ตœ์‹  ๋“œ๋ผ์ด๋ฒ„ ์„ค์น˜: windows 10, 11 dp ์—ฐ๊ฒฐ: ๊ทธ๋ž˜ํ”ฝ ์ถœ๋ ฅ์˜ ์ตœ์ ์€ ํ˜„์žฌ๋กœ์„œ๋Š” dp์ด๋‹ค. dp์„ ์„ ์—ฐ๊ฒฐ ๋‹ค๋ฅธ ์„ ์ด ์žˆ์„ ๊ฒฝ์šฐ ์ œ๊ฑฐํ•˜๋ฉด ๋””ํดํŠธ๋กœ ํ™”๋ฉด ์ถœ๋ ฅ์ด ๋œ๋‹ค.

2023-09-19 ยท 27 words

Openresty - Scalable Web Platform NGINX with Lua

INTRO openresty๋Š” nginx์™€ lua ๊ธฐ๋ฐ˜์˜ ์›น๊ฐœ๋ฐœ ํ”Œ๋žซํผ์ด๋‹ค. lua๋Š” luajit ์„ ์‚ฌ์šฉํ•˜๊ณ  ์—”์ง„์ด ํฌํ•จ๋˜์–ด ์žˆ๋‹ค. ์„œ๋ฒ„์—์„œ ๋™์ž‘ํ•œ๋‹ค. ๋Œ€๋ถ€๋ถ„์˜ ๋ฆฌ๋ˆ…์Šค ๋ฐฐํฌํŒ์€ ํŒจํ‚ค์ง€๋ฅผ ์ง€์›ํ•œ๋‹ค. ์—ฌ๊ธฐ์—์„œ๋Š” docker ์ด๋ฏธ์ง€๋กœ ์„ค์น˜ํ•˜๊ณ  ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์ •๋ฆฌํ•œ๋‹ค. System Info: RaspberryPi 3 Model B Rev 1.2 OS: Raspbian (Debian 11, Bullseye) Docker: version 24.0.5 Getting Started Hello World # Install Docker and Relogin after exit curl -sSL https://get.docker.com | sh sudo usermod -aG docker $usermod exit ... docker run hello-world # Docker Image get docker pull openresty/openresty:alpine # Setup mkdir ~/www cd ~/www mkdir conf html vi conf/nginx.conf ... worker_processes 1; error_log error.log; events { worker_connections 1024; } http { server { listen 8000; location / { default_type text/html; content_by_lua ' ngx.say("<p>hello world!</p>") '; } } } ... # Run openresty docker image docker run --name mresty --rm --volume `pwd`/conf/:/usr/local/openresty/nginx/conf/ \ -p 127.0.0.1:8000:8000 openresty/openresty:alpine # docker process check docker ps # openresty web server test curl localhost:8000 <p>hello world!</p> Openresty Comandline Utility # version check resty -v # Hello World resty -e 'print("Hello World")' echo 'print("Hello World")' > hello.lua resty hello.lua # resty ngx module test time resty -e 'gnx.sleep(1) ngx.say("done")' resty -e 'local sock = ngx.socket.tcp() print(socke:connect("openresty.com",443))' resty -e 'ngx.thread.wait(ngx.thread.spawn(function () print("in thread!") end))' mkdir lua/ vim lua/test.lua ... local _M = {} function _M.hello() print("Hello") end return _M ... resty -e 'require "test".hello()' # Error resty -I lua/ -e 'require "test".hello()' # Hello resty -e 'local ok, stdout = require "resty.shell".run([[echo ok]]) print(stdout)' # ok resty --shdict 'dogs 10m' -e 'print(ngx.shared.dogs:set("age",11))' # truenilfalse resty --shdict 'dogs 7m' --shdict 'cats 5m' -e 'print(ngx.shared.dogs, " ", ngx.shared.cats)' resty --http-conf 'lua_regex_match_limit 102400;' -e 'print "ok"' # Bench Test echo 'local a = 0 for 1, 1e8 do a = a+1 end print(a)' > bench.lua time resty -joff bench.lua # without Jit Compiler time resty bench.lua # with Jit Compiler (Fast) resty -jv bench.lua resty -jdump bench.lua | less # Help resty -h | less # See Help restydoc resty-cli # See Document Structure and Lua Module Create Project Folder and Modules mkdir test-module cd test-module mkdir logs conf lua vim lua/hello.lua ... local _M = {} function _M.greet(name) ngx.say("Greetings from ", name) end return _M ... Setup nginx.conf vim conf/nginx.conf ... worker_processes 1; events { worker_connections 1024; } http { # Lua module Preload for performance and Cache init_by_lua_block { require "hello" } # add module path to lua package path: $prefix means nginx -p option value lua_package_path "$prefix/lua/?.lua;;" # Server Setup: port, lua block... server { listen 8080 reuseport; location / { content_by_lua_block { local hello = require "hello" hello.greet("a Lua module") } } } } ... Server start and Test # server configuration test nginx -p $PWD/ -t # server start nginx -p $PWD/ # Chech Error Log tail logs/error.log # client request test : Browser also available curl 'http://127.0.0.1:8080' Greetins from a Lua module Server Admin # check server process ps aux | grep nginx | grep -v /tmp/ pgrep -l nginx # Edit nginx.conf vim conf/nginx.conf # Server Restart (After editting of nginx.conf) kill -HUP `cat logs/nginx.pid` # client request again curl 'http://127.0.0.1:8080' Build Develop Environment Makefile์„ ๋งŒ๋“ค๊ณ  ๋„์ปค์ด๋ฏธ์ง€๋ฅผ ์ œ์–ดํ•˜๊ณ  ๋กœ๊ทธ ๋“ฑ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋Š” ํ™˜๊ฒฝ์„ ๋งŒ๋“ ๋‹ค. Makefile conf/nginx.conf Test REFERENCE awesome-resty - https://github.com/bungle/awesome-resty ...

2023-09-16 ยท (updated 2023-09-27) ยท 566 words

ํ”Œ๋Ÿฌ๊ทธ์ธ ์—†์ด vim์„ ์ตœ์†Œ ์„ค์ •์œผ๋กœ ์‚ฌ์šฉํ•˜๊ธฐ

์›๊ฒฉ์ง€์—์„œ vi(m)์„ ์‚ฌ์šฉํ•  ๋•Œ ๊ฐ„๋‹จํ•œ ํŽธ์ง‘์€ ๊ดœ์ฐฎ์œผ๋‚˜ ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ•˜๊ฑฐ๋‚˜ ํ•  ๋•Œ์—๋Š” ๋ถˆํŽธํ•˜๋‹ค. ํ•˜์ง€๋งŒ ํ”Œ๋Ÿฌ๊ทธ์ธ๊ณผ ๋งŽ์€ ์„ค์ •์„ ํ•  ๊ฒฝ์šฐ ๋ฒˆ๊ฑฐ๋กญ๊ธฐ๋„ ํ•˜๊ณ  ๋ฌด๊ฑฐ์›Œ์ง€๊ธฐ๋„ ํ•œ๋‹ค. ํ•œ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์€ ๋กœ์ปฌ์˜ ํ™˜๊ฒฝ์—์„œ scp๋ฅผ ์ด์šฉํ•ด ํŽธ์ง‘ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค. nvim scp ์ฐธ์กฐ. ๋˜ ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์€ ์•„์ฃผ ๋ถˆํŽธํ•˜์ง€ ์•Š๋Š” ์„ ์—์„œ ํ™˜๊ฒฝ์„ ์„ค์ •ํ•˜๊ณ  ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค. ์ด ๊ฒฝ์šฐ ํ”Œ๋Ÿฌ๊ทธ์ธ ์‚ฌ์šฉ์„ ํ•˜์ง€ ์•Š๊ณ , ์ตœ์†Œํ•œ์˜ ์„ค์ •๋งŒ ํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ์žฅ์ ์€ ๊ฐ€๋ณ๊ณ  ๋น ๋ฅด๋ฉด์„œ ํ™˜๊ฒฝ์„ค์ •๋„ ์ตœ์†Œํ•œ์œผ๋กœ ํ•  ์ˆ˜ ์žˆ์–ด ํŽธ๋ฆฌํ•˜๋‹ค. ํŠนํžˆ ์›๊ฒฉ์ง€๊ฐ€ ์ €์‚ฌ์–‘ ์ปดํ“จํ„ฐ์ด๊ฑฐ๋‚˜ ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด ๋“ฑ์ผ ๋•Œ ์ ๋‹นํ•˜๋‹ค. Setup how to setup # Install vim or nvim sudo apt install vim # Setup for (v)vim vi ~/.vimrc # Use vi ~/myproject/myfile.c .vimrc " " minimal vimrc with no (extra) plugins " "load system defaults if filereadable(expand('$VIMRUNTIME/defaults.vim')) unlet! g:skip_defaults_vim source $VIMRUNTIME/defaults.vim endif "regular settings "---------------- " ui set number set ruler set wildmenu set showcmd set showmatch " encoding/format set encoding=utf-8 set fileformats=unix,dos,mac " searching set hlsearch set incsearch set ignorecase set smartcase " indent set shiftwidth=4 set tabstop=4 set softtabstop=4 set autoindent " key timeout values set esckeys set ttimeoutlen=20 set timeoutlen=1000 " allow syntax and filetype plugins syntax enable filetype plugin indent on runtime macros/matchit.vim " autocmds "--------- augroup general autocmd! "keep equal proportions when windows resized autocmd VimResized * wincmd = "save cursor position in a file autocmd BufReadPost * if line("'\"") > 1 && line("'\"") \ <= line("$") | exe "normal! g'\"" | endif augroup END augroup languages autocmd! autocmd BufNewFile,BufRead *.bash set syntax=sh autocmd FileType python xnoremap <leader>r <esc>:'<,'>:w !python3<CR> autocmd FileType go set noexpandtab autocmd FileType html :syntax sync fromstart autocmd FileType html,javascript,css,json,yaml,sh \ setlocal ts=2 sts=2 sw=2 expandtab augroup END REFERENCE A minimal Vimrc - https://madjam.dev/posts/a-minimal-vimrc/

2023-09-16 ยท 265 words

keyboard - ํ‚ค๋ณด๋“œ

ํ‚ค๋ณด๋“œ๋Š” ์‚ฌ๋žŒ์ด ์ปดํ“จํ„ฐ์—๊ฒŒ ์ง€์‹œํ•˜๋Š” ์œ ์ผํ•œ ํ†ต๋กœ์ด๋‹ค. ๋ฌผ๋ก  ๋งˆ์šฐ์Šค ๋“ฑ์ด ์žˆ์ง€๋งŒ ํ‚ค๋ณด๋“œ๊ฐ€ ๊ฐ€์žฅ ๋จผ์ €์ด๋ฉด์„œ ์˜ค๋ž˜๋˜์—ˆ๊ณ  ๋˜ํ•œ ์ƒ์„ธํ•˜๊ฒŒ ๋ช…๋ น์„ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ๋Š” ๋„๊ตฌ์ด๋‹ค. ์‚ฌ๋žŒ์ด ์ง์ ‘์ ์œผ๋กœ ํ™œ๋™ํ•˜๋Š” ๋งค์ฒด๊ฐ€ ํ‚ค๋ณด๋“œ์ด๊ธฐ ๋•Œ๋ฌธ์— ์ข€ ๋” ํŠน๋ณ„ํ•˜๊ธฐ๋„ ํ•˜๋‹ค. ๋˜ํ•œ ์ ‘์ด‰ํ•˜๋Š” ๋งค์ฒด๋กœ์„œ ๊ฑด๊ฐ•๊ณผ ๋А๋‚Œ์ด ๋งŽ์ด ์ž‘์šฉํ•˜๋Š” ๊ฒƒ์ด ํ‚ค๋ณด๋“œ์ด๊ธฐ๋„ ํ•˜๋‹ค. ๊ธ€ ์‹ฃ๋Š” ์ˆœ์„œ ํ•œ๊ธ€ํ‚ค๋ณด๋“œ ์ž…๋ ฅ๋ฐฉ์‹. ์˜๋ฌธํ‚ค๋ณด๋“œ ์ž…๋ ฅ๋ฐฉ์‹. ์†์— ๋ฌด๋ฆฌ๋ฅผ ์ฃผ์ง€ ์•Š์œผ๋ฉด์„œ ํšจ์œจ์ ์ธ ํ‚ค๋ณด๋“œ ์ž…๋ ฅ ๋ฐฉ์‹์€ ๋ฌด์—‡์ธ๊ฐ€. ์•„๋‘์ด๋…ธ๋ฅผ ํ™œ์šฉํ•œ ๋ถ„๋ฆฌํ˜• ํ‚ค๋ณด๋“œ ๋งŒ๋“ค๊ธฐ. ํ‚ค๋ณด๋“œ ์—ฐ์Šต ํƒ€์ดํ•‘์›์Šค - ํ•œ,์˜ ์ง€์›, ๊น”๋”ํ•œ ํ™˜๊ฒฝ๊ณผ ๋””์ž์ธ, ์›น: https://typing.works/ monkeytype - ํ•œ๊ธ€,์˜๋ฌธ ๋ฐ ๋‹ค๊ตญ์–ด ์ง€์›, ํ†ต๊ณ„: https://monkeytype.com/ keybr.com - ์˜๋ฌธ ์—ฐ์Šต, ํ•œ๊ธ€ ๋ฏธ์ง€์›, ํ†ต๊ณ„, qwerty,dvorak,workman,colmak: https://www.keybr.com typeracer.com - ๊ฒŒ์ž„์‹ ํƒ€์ž ์—ฐ์Šต (์ž๋™์ฐจ ๊ฒฝ์ฃผ) colemak club - colemak, colemak-dh ์—ฐ์Šต: https://gnusenpai.net/colemakclub/ ํ•œ๊ธ€ ์žํŒ ๋ฐฐ์—ด ๋‘๋ฒŒ์‹ ์„ธ๋ฒŒ์‹: https://์„ธ๋ฒŒ์‹.kr/ ํƒ€์ž ์—ฐ์Šต ํ”„๋กœ๊ทธ๋žจ ํ•œ์ปด ํƒ€์ž์—ฐ์Šต (์›น, ์œˆ๋„์šฐ์ฆˆ) : https://www.hancomtaja.com/ ๋‚ ๊ฐœ์…‹ ํƒ€์ž์—ฐ์Šต (์œˆ๋„์šฐ์ฆˆ) ์—ด๋ฆฐํƒ€์ž (์œˆ๋„์šฐ์ฆˆ) Taza (macOS) ์†๊ธฐํƒ€์ž: ์„ธ๋ฒŒ์‹ (cas, sorijava) - ๋‘ ๊ฐœ ๋ชจ๋‘ ์žํŒ ๋ฐฐ์—ด์ด ๋‹ค๋ฅด๋‹ค. ์˜๋ฌธ ์žํŒ ๋ฐฐ์—ด qwerty - ํƒ€์ž๊ธฐ์˜ ์›ํ˜•, ์‚ฌ์‹ค์ƒ์˜ ํ‘œ์ค€ dvorak - ๋˜ ๋‹ค๋ฅธ ํ‘œ์ค€ colmak - ๊ฐ€์žฅ ํšจ์œจ์ ์ด๋ฉด์„œ qwerty์™€ ์œ ์‚ฌํ•ด์„œ ์ ์‘๋„ ๋น ๋ฅด๋‹ค. colemak home: https://colemak.com/ Learn : https://colemak.com/Learn (์šฐ์ธก ํ•˜๋‹จ keyboard Mapping: on์œผ๋กœ) workman ํ‚ค๋ณด๋“œ ๋ฐฐ์—ด Staggered: ํ–‰๋งˆ๋‹ค ์ ˆ๋ฐ˜์”ฉ ์—‡๊ฐˆ๋ ค ๋ฐฐ์น˜ Ortholinear: ํ–‰๋งˆ๋‹ค ๋˜‘๊ฐ™์ด ๋ฐฐ์น˜ HARDWARE Key caps ...

2023-09-10 ยท (updated 2023-09-12) ยท 229 words