Browse Source

fix drone.yml

master
Gisle Aune 4 years ago
parent
commit
fec21a0045
  1. 81
      .drone.yml
  2. 12
      Dockerfile

81
.drone.yml

@ -1,21 +1,70 @@
workspace:
base: /go
path: src/git.aiterp.net/rpdata/logbot3
name: logbot3
pipeline:
docker-release:
kind: pipeline
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
repo: vmaple/rpdata-logbot3
auto_tag: true
secrets: [ docker_username, docker_password ]
settings:
auto_tag: true
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: r.vmaple.dev/rpdata/logbot3
when:
event: tag
ref: refs/tags/*
docker-release-latest:
event:
- tag
- name: docker-release-latest
image: plugins/docker
repo: vmaple/rpdata-logbot3
tags: latest
secrets: [ docker_username, docker_password ]
settings:
auto_tag: false
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: r.vmaple.dev/rpdata/logbot3
when:
event: tag
ref: refs/tags/*
event:
- tag⏎

12
Dockerfile

@ -3,27 +3,25 @@
FROM golang:1.11 AS build
# Load repository into docker
WORKDIR /go/src/git.aiterp.net/rpdata/logbot3/
WORKDIR /project
COPY . .
RUN rm -rf ./vendor
# Load and run dependencies
RUN go get -u github.com/golang/dep/cmd/dep
RUN dep ensure
RUN go get
# Build server and tools (CGO disabled to make them 100% static)
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
# Use alpine linux
FROM alpine:3.8 as main-dist
FROM alpine:3.12 as main-dist
# Install certificates to enable HTTPS GET requests
RUN apk add --no-cache ca-certificates
# 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
CMD ["/usr/local/bin/logbot3"]
Loading…
Cancel
Save