Add CI/CD
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
nemunaire 2021-02-04 04:52:15 +01:00
parent 383cc1b94e
commit 9d069b7f6c
3 changed files with 122 additions and 0 deletions

22
.drone-manifest.yml Normal file
View File

@ -0,0 +1,22 @@
image: nemunaire/linky2influx:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
- image: nemunaire/linky2influx:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
- image: nemunaire/linky2influx:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
platform:
architecture: arm64
os: linux
variant: v8
- image: nemunaire/linky2influx:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux
variant: v7

83
.drone.yml Normal file
View File

@ -0,0 +1,83 @@
---
kind: pipeline
type: docker
name: build-arm64
platform:
os: linux
arch: arm64
steps:
- name: linky2influx
image: golang:alpine
commands:
- apk --no-cache add build-base
- go get -d -v
- go build -v
- name: publish
image: plugins/docker
settings:
repo: nemunaire/linky2influx
auto_tag: true
auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
username:
from_secret: docker_username
password:
from_secret: docker_password
---
kind: pipeline
type: docker
name: build-arm
platform:
os: linux
arch: arm
steps:
- name: linky2influx
image: golang:alpine
commands:
- apk --no-cache add build-base
- go get -d -v
- go vet -v
- go build -v
- name: publish
image: plugins/docker
settings:
repo: nemunaire/linky2influx
auto_tag: true
auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
custom_dns: 192.168.0.254
custom_dns_search: ""
username:
from_secret: docker_username
password:
from_secret: docker_password
---
kind: pipeline
name: docker-manifest
steps:
- name: publish
image: plugins/manifest
settings:
auto_tag: true
ignore_missing: true
spec: .drone-manifest.yml
username:
from_secret: docker_username
password:
from_secret: docker_password
trigger:
event:
- push
- tag
depends_on:
- build-arm
- build-arm64

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM golang:alpine as gobuild
RUN apk add --no-cache build-base
WORKDIR /go/src/git.nemunai.re/linky2influx
COPY *.go go.mod go.sum ./
RUN go get -d -v && \
go build -v
FROM alpine
CMD ["linky2influx"]
COPY --from=gobuild /go/src/git.nemunai.re/linky2influx/linky2influx /usr/bin/linky2influx