diff --git a/.drone.yml b/.drone.yml index cfe9564..f0a3ada 100644 --- a/.drone.yml +++ b/.drone.yml @@ -20,6 +20,16 @@ steps: commands: - echo bonjour monde + - name: docker + image: plugins/docker + repo: esinio/helloworld + auto_tag: true + auto_tag_suffix: linux-amd64 + username: + from_secret: docker_username + password: + from_secret: docker_password + trigger: branch: - master diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b5ffeb5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM golang:alpine as builder + +ENV CGO_ENABLED=0 +ENV GOOS="linux" +ENV GOARCH="amd64" + +RUN apk --no-cache add ca-certificates +RUN go build -ldflags="-s -w" -tags timetzdata -o app main.go + +FROM scratch as production + +ENV TZ="Asia/Shanghai" + +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=builder /app . + + +CMD ["./app"] \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..d04e915 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module git.esin.io/lab/drone-ci-demo + +go 1.17 diff --git a/main.go b/main.go new file mode 100644 index 0000000..52a7925 --- /dev/null +++ b/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("hello world") +}