Last active
July 3, 2023 05:43
-
-
Save manhdaovan/b60ce1de6164cfea8e675064dbdc38e9 to your computer and use it in GitHub Desktop.
Revisions
-
manhdaovan revised this gist
Jul 3, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,2 @@ cd /app ./test_graceful -
manhdaovan created this gist
Jul 3, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ FROM alpine:latest WORKDIR /app COPY . /app ENTRYPOINT [ "ash", "entry.sh" ] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ build-app: GOOS=linux go build -o test_graceful main.go && \ chmod +x test_graceful build-image: build-app docker build -t test_graceful . run-app-on-docker: docker run -it test_graceful This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ cd /app ./test_gracefulMaMak This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ package main import ( "fmt" "os" "os/signal" "syscall" ) func main() { fmt.Println("main started") shutdown := make(chan os.Signal, 2) signal.Notify(shutdown, syscall.SIGINT, syscall.SIGTERM) select { case s := <-shutdown: fmt.Println("shutdown server by received signal:", s.String()) } }