fix drone.yml

This commit is contained in:
2020-07-17 18:14:19 +02:00
parent d721112738
commit fec21a0045
2 changed files with 72 additions and 25 deletions
+64 -15
View File
@@ -1,21 +1,70 @@
workspace: name: logbot3
base: /go
path: src/git.aiterp.net/rpdata/logbot3
pipeline: kind: pipeline
docker-release: type: docker
steps:
- name: go-build-1.11
image: golang:1.11
commands:
- go mod download
- CGO_ENABLED=0 go build -ldflags "-w -s" .
when:
event:
exclude:
- tag
- name: go-build-1.12
image: golang:1.12
commands:
- go mod download
- CGO_ENABLED=0 go build -ldflags "-w -s" .
when:
event:
exclude:
- tag
- name: go-build-1.13
image: golang:1.13
commands:
- go mod download
- CGO_ENABLED=0 go build -ldflags "-w -s" .
when:
event:
exclude:
- tag
- name: go-test
image: golang:1.13
commands:
- go test -v ./...
when:
event:
exclude:
- tag
- name: docker-release-tag
image: plugins/docker image: plugins/docker
repo: vmaple/rpdata-logbot3 settings:
auto_tag: true auto_tag: true
secrets: [ docker_username, docker_password ] username:
from_secret: docker_username
password:
from_secret: docker_password
repo: r.vmaple.dev/rpdata/logbot3
when: when:
event: tag event:
ref: refs/tags/* - tag
docker-release-latest:
- name: docker-release-latest
image: plugins/docker image: plugins/docker
repo: vmaple/rpdata-logbot3 settings:
tags: latest auto_tag: false
secrets: [ docker_username, docker_password ] username:
from_secret: docker_username
password:
from_secret: docker_password
repo: r.vmaple.dev/rpdata/logbot3
when: when:
event: tag event:
ref: refs/tags/* - tag⏎
+5 -7
View File
@@ -3,27 +3,25 @@
FROM golang:1.11 AS build FROM golang:1.11 AS build
# Load repository into docker # Load repository into docker
WORKDIR /go/src/git.aiterp.net/rpdata/logbot3/ WORKDIR /project
COPY . . COPY . .
RUN rm -rf ./vendor
# Load and run dependencies # Load and run dependencies
RUN go get -u github.com/golang/dep/cmd/dep RUN go get
RUN dep ensure
# Build server and tools (CGO disabled to make them 100% static) # Build server and tools (CGO disabled to make them 100% static)
ENV CGO_ENABLED 0 ENV CGO_ENABLED 0
RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/logbot3 . RUN go build -a -installsuffix cgo -ldflags="-s -w" -o logbot3 .
## 2. Distribute ## 2. Distribute
# Use alpine linux # Use alpine linux
FROM alpine:3.8 as main-dist FROM alpine:3.12 as main-dist
# Install certificates to enable HTTPS GET requests # Install certificates to enable HTTPS GET requests
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates
# Copy build files into final container # Copy build files into final container
COPY --from=build /binaries/* /usr/local/bin/ COPY --from=build /project/logbot3 /usr/local/bin/
# The server is the main entry point # The server is the main entry point
CMD ["/usr/local/bin/logbot3"] CMD ["/usr/local/bin/logbot3"]