feat: add plugins/docker
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
lab 2021-12-05 00:41:44 +08:00
parent 7fda47cdcd
commit 2a73023dca
4 changed files with 40 additions and 0 deletions

View File

@ -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

18
Dockerfile Normal file
View File

@ -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"]

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module git.esin.io/lab/drone-ci-demo
go 1.17

9
main.go Normal file
View File

@ -0,0 +1,9 @@
package main
import (
"fmt"
)
func main() {
fmt.Println("hello world")
}