Added .drone.yml
This commit is contained in:
parent
1926784e55
commit
0150d47429
|
@ -0,0 +1,39 @@
|
||||||
|
pipeline:
|
||||||
|
prebuild:
|
||||||
|
image: golang:latest
|
||||||
|
commands:
|
||||||
|
- IMAGE=dr.dnix.de/$DRONE_REPO_NAME
|
||||||
|
- REV=$(git rev-list HEAD --count)
|
||||||
|
- BUILDDATE=$(date)
|
||||||
|
- BRANCH=$DRONE_COMMIT_BRANCH
|
||||||
|
- TAGS=.tags
|
||||||
|
- echo "Building image $IMAGE:$BRANCH-$REV"
|
||||||
|
- echo -n "$BRANCH-$REV" >$TAGS
|
||||||
|
- cat $TAGS
|
||||||
|
build_docker:
|
||||||
|
image: plugins/docker
|
||||||
|
repo: dr.dnix.de/${DRONE_REPO_NAME}
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
deploy:
|
||||||
|
image: ubuntu:16.04
|
||||||
|
secrets:
|
||||||
|
- K8S_SSH_PRIVATE_KEY
|
||||||
|
- K8S_SSH_PUBLIC_KEY
|
||||||
|
commands:
|
||||||
|
- apt update
|
||||||
|
- apt -y upgrade
|
||||||
|
- apt install -y git
|
||||||
|
- IMAGE=dr.dnix.de/$DRONE_REPO_NAME
|
||||||
|
- BRANCH=$DRONE_COMMIT_BRANCH
|
||||||
|
- REV=$(git rev-list HEAD --count)
|
||||||
|
- echo "Deploying image $IMAGE:$BRANCH-$REV"
|
||||||
|
- cd ~
|
||||||
|
- mkdir .ssh
|
||||||
|
- chmod 700 .ssh
|
||||||
|
- echo "$K8S_SSH_PRIVATE_KEY" >.ssh/id_rsa
|
||||||
|
- chmod 600 .ssh/id_rsa
|
||||||
|
- echo "$K8S_SSH_PUBLIC_KEY" >.ssh/id_rsa.pub
|
||||||
|
- chmod 600 .ssh/id_rsa.pub
|
||||||
|
- ssh -oStrictHostKeyChecking=no root@master01 "kubectl set image deployment/image-transformer image-transforめer=dr.dnix.de/image-transformer:$BRANCH-$REV -n dnix-image-transformer"
|
||||||
|
- ssh -oStrictHostKeyChecking=no root@master01 "kubectl rollout status deployment/image-transformer -n image-transformer"
|
3
main.go
3
main.go
|
@ -77,7 +77,7 @@ func resizeHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
// it since we are directly piping it to the ResponseWriter
|
// it since we are directly piping it to the ResponseWriter
|
||||||
_, _, err = vips.NewTransform().
|
_, _, err = vips.NewTransform().
|
||||||
Load(resp.Body).
|
Load(resp.Body).
|
||||||
ResizeStrategy(vips.ResizeStrategyEmbed).
|
ResizeStrategy(vips.ResizeStrategyAuto).
|
||||||
Resize(iw, ih).
|
Resize(iw, ih).
|
||||||
Output(w).
|
Output(w).
|
||||||
Apply()
|
Apply()
|
||||||
|
@ -86,6 +86,7 @@ func resizeHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
writeError(w, imgPath, method, "failed to resize", http.StatusInternalServerError)
|
writeError(w, imgPath, method, "failed to resize", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
case "thumbnail":
|
||||||
|
|
||||||
default:
|
default:
|
||||||
writeError(w, imgPath, method, "unknown method", http.StatusBadRequest)
|
writeError(w, imgPath, method, "unknown method", http.StatusBadRequest)
|
||||||
|
|
Loading…
Reference in New Issue