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 - name: build
image: golang:1.11 image: golang:1.11
commands: commands:
- go version
- go env
- go get -u github.com/golang/dep/cmd/dep - go get -u github.com/golang/dep/cmd/dep
- make build - make build-all-static
--- - name: push amd64 image
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 image: plugins/docker
settings: settings:
repo: iamthefij/dockron repo: iamthefij/dockron
auto_tag: true tag: linux-amd64
auto_tag_suffix: linux-amd64
username: username:
from_secret: docker_username from_secret: docker_username
password: password:
from_secret: docker_password from_secret: docker_password
--- - name: push arm image
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 image: plugins/docker
settings: settings:
repo: iamthefij/dockron repo: iamthefij/dockron
auto_tag: true tag: linux-arm
auto_tag_suffix: linux-arm
username: username:
from_secret: docker_username from_secret: docker_username
password: password:
@ -72,63 +34,122 @@ steps:
- ARCH=arm - ARCH=arm
- REPO=arm32v6 - REPO=arm32v6
--- # ---
kind: pipeline # kind: pipeline
name: linux-arm64 # name: linux-amd64
#
depends_on: # depends_on:
- test # - test
#
trigger: # trigger:
event: # event:
- push # - push
- tag # - tag
refs: # refs:
- refs/heads/master # - refs/heads/master
- refs/tags/v* # - refs/tags/v*
#
steps: # steps:
#
- name: build # - name: build
image: plugins/docker # image: plugins/docker
settings: # settings:
repo: iamthefij/dockron # repo: iamthefij/dockron
auto_tag: true # auto_tag: true
auto_tag_suffix: linux-arm64 # auto_tag_suffix: linux-amd64
username: # username:
from_secret: docker_username # from_secret: docker_username
password: # password:
from_secret: docker_password # from_secret: docker_password
build_args: #
- ARCH=arm64 # ---
- REPO=arm64v8 # kind: pipeline
# name: linux-arm
--- #
kind: pipeline # depends_on:
name: manifest # - test
#
depends_on: # trigger:
- linux-amd64 # event:
- linux-arm # - push
- linux-arm64 # - tag
# refs:
trigger: # - refs/heads/master
event: # - refs/tags/v*
- push #
- tag # steps:
ref: #
- refs/heads/master # - name: build
- refs/tags/v* # image: plugins/docker
# settings:
steps: # repo: iamthefij/dockron
- name: publish manifest # auto_tag: true
image: plugins/manifest # auto_tag_suffix: linux-arm
settings: # username:
spec: manifest.tmpl # from_secret: docker_username
auto_tag: true # password:
ignore_missing: true # from_secret: docker_password
username: # build_args:
from_secret: docker_username # - ARCH=arm
password: # - REPO=arm32v6
from_secret: docker_password #
# ---
# 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 ARG REPO=library
FROM golang:1.11-alpine AS builder # FROM golang:1.11-alpine AS builder
#
RUN apk add --no-cache git # RUN apk add --no-cache git
RUN go get -u github.com/golang/dep/cmd/dep # RUN go get -u github.com/golang/dep/cmd/dep
#
WORKDIR /go/src/app/ # WORKDIR /go/src/app/
COPY ./Gopkg.* /go/src/app/ # COPY ./Gopkg.* /go/src/app/
RUN dep ensure --vendor-only # RUN dep ensure --vendor-only
#
COPY ./main.go /go/src/app/ # COPY ./main.go /go/src/app/
#
ARG ARCH=amd64 # RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -installsuffix nocgo -o dockron .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -installsuffix nocgo -o dockron .
FROM ${REPO}/busybox:latest FROM ${REPO}/busybox:latest
WORKDIR /root/ 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" ] CMD [ "./dockron" ]

View File

@ -20,6 +20,18 @@ dockron: vendor
.PHONY: build .PHONY: build
build: dockron 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 # Cleans all build artifacts
.PHONY: clean .PHONY: clean
clean: clean: