Compare commits

...

4 Commits

Author SHA1 Message Date
lab
548ede135c fix: remove -race option from go build
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2021-12-25 02:31:56 +08:00
lab
b7255bf031 fea: add Dockerfile 2021-12-25 02:30:17 +08:00
lab
7dfb33a471 feat: init go mod 2021-12-25 02:16:59 +08:00
lab
a3d4bbf5de feat: add drone pipelines 2021-12-25 02:06:49 +08:00
4 changed files with 74 additions and 0 deletions

48
.drone.yml Normal file
View File

@ -0,0 +1,48 @@
kind: pipeline
type: docker
name: default
platform:
os: linux
arch: amd64
steps:
- name: build
image: glang:1.17-alpine
pull: if-not-exists
environment:
CGO_ENABLED: 0
GOOS: linux
GOARCH: amd64
commands:
- env
- go build -tags timetzdata -v -o app cmd/apiserver/main.go
- name: publish
images: plugins/docker
pull: if-not-exists
settings:
repo: esinio/kimbon:apiserver
username:
from_secret: docker_username
password:
from_secret: docker_password
- name: deploy
image: docker/compose:1.29.2
pull: if-not-exists
volumes:
- name: docker_sock
path: /var/run/docker.sock
commands:
- docker-compose up --detach --verbose --force-recreate --file ./docker-compose.yml
when:
event:
- promote
target:
- production
volumes:
- name: docker-sock
host:
path: /var/run/docker.sock

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM alpine:3.14 as builder
RUN apk --no-cache add ca-certificates
FROM scratch as production
ENV TZ="Asia/Shanghai"
COPY ./app /
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
CMD ["/app"]

11
cmd/apiserver/main.go Normal file
View File

@ -0,0 +1,11 @@
package main
func main() {
if err := run(); err != nil {
panic(err)
}
}
func run() error {
return nil
}

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module git.esin.io/kimbon/weapp
go 1.17