Try to speed up build
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
IamTheFij 2019-06-07 16:15:50 -07:00
parent d2807c74b1
commit 02899944a9
3 changed files with 151 additions and 117 deletions

View File

@ -8,62 +8,24 @@ steps:
- name: build
image: golang:1.11
commands:
- go version
- go env
- go get -u github.com/golang/dep/cmd/dep
- make build
- make build-all-static
---
kind: pipeline
name: linux-amd64
depends_on:
- test
trigger:
event:
- push
- tag
refs:
- refs/heads/master
- refs/tags/v*
steps:
- name: build
- name: push amd64 image
image: plugins/docker
settings:
repo: iamthefij/dockron
auto_tag: true
auto_tag_suffix: linux-amd64
tag: linux-amd64
username:
from_secret: docker_username
password:
from_secret: docker_password
---
kind: pipeline
name: linux-arm
depends_on:
- test
trigger:
event:
- push
- tag
refs:
- refs/heads/master
- refs/tags/v*
steps:
- name: build
- name: push arm image
image: plugins/docker
settings:
repo: iamthefij/dockron
auto_tag: true
auto_tag_suffix: linux-arm
tag: linux-arm
username:
from_secret: docker_username
password:
@ -72,63 +34,122 @@ steps:
- ARCH=arm
- REPO=arm32v6
---
kind: pipeline
name: linux-arm64
depends_on:
- test
trigger:
event:
- push
- tag
refs:
- refs/heads/master
- refs/tags/v*
steps:
- name: build
image: plugins/docker
settings:
repo: iamthefij/dockron
auto_tag: true
auto_tag_suffix: linux-arm64
username:
from_secret: docker_username
password:
from_secret: docker_password
build_args:
- ARCH=arm64
- REPO=arm64v8
---
kind: pipeline
name: manifest
depends_on:
- linux-amd64
- linux-arm
- linux-arm64
trigger:
event:
- push
- tag
ref:
- refs/heads/master
- refs/tags/v*
steps:
- name: publish manifest
image: plugins/manifest
settings:
spec: manifest.tmpl
auto_tag: true
ignore_missing: true
username:
from_secret: docker_username
password:
from_secret: docker_password
# ---
# kind: pipeline
# name: linux-amd64
#
# depends_on:
# - test
#
# trigger:
# event:
# - push
# - tag
# refs:
# - refs/heads/master
# - refs/tags/v*
#
# steps:
#
# - name: build
# image: plugins/docker
# settings:
# repo: iamthefij/dockron
# auto_tag: true
# auto_tag_suffix: linux-amd64
# username:
# from_secret: docker_username
# password:
# from_secret: docker_password
#
# ---
# kind: pipeline
# name: linux-arm
#
# depends_on:
# - test
#
# trigger:
# event:
# - push
# - tag
# refs:
# - refs/heads/master
# - refs/tags/v*
#
# steps:
#
# - name: build
# image: plugins/docker
# settings:
# repo: iamthefij/dockron
# auto_tag: true
# auto_tag_suffix: linux-arm
# username:
# from_secret: docker_username
# password:
# from_secret: docker_password
# build_args:
# - ARCH=arm
# - REPO=arm32v6
#
# ---
# kind: pipeline
# name: linux-arm64
#
# depends_on:
# - test
#
# trigger:
# event:
# - push
# - tag
# refs:
# - refs/heads/master
# - refs/tags/v*
#
# steps:
#
# - name: build
# image: plugins/docker
# settings:
# repo: iamthefij/dockron
# auto_tag: true
# auto_tag_suffix: linux-arm64
# username:
# from_secret: docker_username
# password:
# from_secret: docker_password
# build_args:
# - ARCH=arm64
# - REPO=arm64v8
#
# ---
# kind: pipeline
# name: manifest
#
# depends_on:
# - linux-amd64
# - linux-arm
# - linux-arm64
#
# trigger:
# event:
# - push
# - tag
# ref:
# - refs/heads/master
# - refs/tags/v*
#
# steps:
# - name: publish manifest
# image: plugins/manifest
# settings:
# spec: manifest.tmpl
# auto_tag: true
# ignore_missing: true
# username:
# from_secret: docker_username
# password:
# from_secret: docker_password
#

View File

@ -1,20 +1,21 @@
ARG REPO=library
FROM golang:1.11-alpine AS builder
RUN apk add --no-cache git
RUN go get -u github.com/golang/dep/cmd/dep
WORKDIR /go/src/app/
COPY ./Gopkg.* /go/src/app/
RUN dep ensure --vendor-only
COPY ./main.go /go/src/app/
ARG ARCH=amd64
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -installsuffix nocgo -o dockron .
# FROM golang:1.11-alpine AS builder
#
# RUN apk add --no-cache git
# RUN go get -u github.com/golang/dep/cmd/dep
#
# WORKDIR /go/src/app/
# COPY ./Gopkg.* /go/src/app/
# RUN dep ensure --vendor-only
#
# COPY ./main.go /go/src/app/
#
# RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -installsuffix nocgo -o dockron .
FROM ${REPO}/busybox:latest
WORKDIR /root/
COPY --from=builder /go/src/app/dockron .
# COPY --from=builder /go/src/app/dockron .
ARG ARCH=amd64
COPY ./dockron-linux-${ARCH} .
CMD [ "./dockron" ]

View File

@ -20,6 +20,18 @@ dockron: vendor
.PHONY: build
build: dockron
dockron-linux-amd64: vendor
GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o dockron-linux-amd64
dockron-linux-arm: vendor
GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o dockron-linux-arm
dockron-linux-arm64: vendor
GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o dockron-linux-arm64
.PHONY: build-all-static
build-all-static: dockron-linux-amd64 dockron-linux-arm dockron-linux-arm64
# Cleans all build artifacts
.PHONY: clean
clean: