linzhengen / tech-notes

My tech notes write in github issues🧲
1 stars 0 forks source link

[20210729] SkaffoldでHotReload環境を構築してみた #127

Open linzhengen opened 3 years ago

linzhengen commented 3 years ago

Skaffold

https://github.com/GoogleContainerTools/skaffold

成果物

https://github.com/linzhengen/ddd-gin-admin/blob/main/skaffold.yaml

ファイル変更があったら、コンテナ再ビルドされて、Minikubeにhelm でデプロイされる

 - ddd-gin-admin:deployment/ddd-gin-admin-web is ready.
...
Checking cache...
DEBU[1924] Change detected notify.Rename: "/Users/seion/work/ddd-gin-admin/.git/index" 
DEBU[1924] Change detected notify.Rename: "/Users/seion/work/ddd-gin-admin/.git/index.lock" 
DEBU[1924] Change detected notify.Write: "/Users/seion/work/ddd-gin-admin/.git/index.lock" 
DEBU[1924] Change detected notify.Rename: "/Users/seion/work/ddd-gin-admin/.git/index" 
DEBU[1924] Could not import artifact from Docker, building instead (import of missing images disabled) 
 - ddd-gin-admin: Not found. Building
INFO[1924] Cache check completed in 142.112417ms        
Starting build...
Found [minikube] context, using local docker daemon.
Building [ddd-gin-admin]...
DEBU[1924] Running docker build: context: ., dockerfile: Dockerfile.dev 
DEBU[1924] Skipping credential configuration because docker-credential-gcloud is not on PATH. 
Sending build context to Docker daemon  70.86MB
Step 1/8 : FROM golang:1.16.6-alpine3.14 as build-env
 ---> d98f5e550f33
Step 2/8 : WORKDIR /go/src/app
 ---> Using cache
 ---> b272bb0b0879
Step 3/8 : ADD . /go/src/app
 ---> 0d7a8f93fe05
Step 4/8 : RUN go mod download &&     GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /go/src/app/main/app /go/src/app/main
 ---> Running in 93c55e4d65ff
 ---> f2b4d3dd2714
Step 5/8 : FROM alpine:3.14
 ---> b0e47758dc53
Step 6/8 : COPY --from=build-env /go/src/app/main/app /app
 ---> Using cache
 ---> 14224ebe2ac5
Step 7/8 : COPY --from=build-env /go/src/app/configs/ /
 ---> Using cache
 ---> 9b99ba847d51
Step 8/8 : CMD ["/app", "web", "-c", "/config.toml", "-m", "/model.conf", "--menu", "/menu.yaml"]
 ---> Using cache
 ---> e59a2c73349f
Successfully built e59a2c73349f
Successfully tagged ddd-gin-admin:6485bc8
INFO[1985] Build completed in 1 minute 1.536 second     
DEBU[1985] push value not present in isImageLocal(), defaulting to false because cluster.PushImages is false 
Starting test...
INFO[1985] Test completed in 17.25µs                    
DEBU[1985] stopping accessor                            
DEBU[1985] stopping debugger                            
Tags used in deployment:
 - ddd-gin-admin -> ddd-gin-admin:e59a2c73349f7df82bc7f5865ad1a3b2f4ddfcc222bb1d3229136b0978de5570
DEBU[1985] push value not present in isImageLocal(), defaulting to false because cluster.PushImages is false 
DEBU[1985] Local images can't be referenced by digest.
They are tagged and referenced by a unique, local only, tag instead.
See https://skaffold.dev/docs/pipeline-stages/taggers/#how-tagging-works 
Starting deploy...
DEBU[1985] getting client config for kubeContext: ``    
INFO[1985] Deploying with helm v3.6.3 ...               
....
DEBU[1987] Command output: [deployment "ddd-gin-admin-web" successfully rolled out
] 
 - ddd-gin-admin:deployment/ddd-gin-admin-web is ready.
Deployments stabilized in 1.193 second
Watching for changes...
DEBU[1987] Found dependencies for dockerfile: [{. /go/src/app false}]