This commit is contained in:
parent
1c22b18fd2
commit
2f4c15eb9f
36
.drone.yml
Normal file
36
.drone.yml
Normal file
@ -0,0 +1,36 @@
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: linter
|
||||
image: golang:latest
|
||||
environment:
|
||||
GOPROXY: https://mirrors.aliyun.com/goproxy/
|
||||
commands:
|
||||
- go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||
- golangci-lint run
|
||||
|
||||
- name: build
|
||||
image: golang:latest
|
||||
environment:
|
||||
GOPROXY: https://mirrors.aliyun.com/goproxy/
|
||||
GOOS: linux
|
||||
GOARCH: amd64
|
||||
CGO_ENABLED: 0
|
||||
commands:
|
||||
- go build -o demo-app
|
||||
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: docker.gitee.ltd
|
||||
repo: docker.gitee.ltd/lxh/golang-demo
|
||||
use_cache: true
|
||||
username: docker
|
||||
password: dockeruser
|
||||
tags:
|
||||
- latest
|
||||
- 0.0.1
|
||||
when:
|
||||
event: push
|
||||
branch: master
|
23
main.go
Normal file
23
main.go
Normal file
@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func main() {
|
||||
r := gin.Default()
|
||||
|
||||
r.GET("/health", func(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H {
|
||||
"health": true,
|
||||
})
|
||||
})
|
||||
|
||||
if err := r.Run(":8080"); err != nil {
|
||||
logrus.WithError(err).Fatal("Couldn't listen")
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user