Compare commits

...

11 Commits

Author SHA1 Message Date
4597842ccf Clean up slimmed build
All checks were successful
continuous-integration/drone/push Build is passing
2019-06-07 16:29:53 -07:00
64b28038e9 Rename binary within Docker image
All checks were successful
continuous-integration/drone/push Build is passing
2019-06-07 16:21:02 -07:00
726748852e Move src to gopath subdir
All checks were successful
continuous-integration/drone/push Build is passing
2019-06-07 16:19:56 -07:00
758180407f Move src to gopath
Some checks failed
continuous-integration/drone/push Build is failing
2019-06-07 16:19:03 -07:00
b1be36afdf Try to change workspace
Some checks failed
continuous-integration/drone/push Build is failing
2019-06-07 16:17:12 -07:00
02899944a9 Try to speed up build
Some checks failed
continuous-integration/drone/push Build is failing
2019-06-07 16:15:50 -07:00
d2807c74b1 Add back manifest and correct tagging
Some checks failed
continuous-integration/drone/push Build is failing
2019-06-07 15:55:21 -07:00
12f48e2c6d Try to get it to build again
All checks were successful
continuous-integration/drone/push Build is passing
2019-06-07 15:46:12 -07:00
7b94fb20f5 Try to get it to build again
All checks were successful
continuous-integration/drone/push Build is passing
2019-06-07 15:43:24 -07:00
6d8a666213 Try to get it to build
All checks were successful
continuous-integration/drone/push Build is passing
2019-06-07 15:41:16 -07:00
7c6e536ec3 Try out multi arch builds
All checks were successful
continuous-integration/drone/push Build is passing
2019-06-07 15:40:04 -07:00
5 changed files with 157 additions and 37 deletions

View File

@ -1,28 +1,87 @@
platform: ${platform} kind: pipeline
name: test
workspace: workspace:
base: /go base: /go/src/dockron
pipeline: steps:
build: - name: build
image: golang:1.10 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
# publish:
# image: plugins/docker:${docker_tag}
# repo: iamthefij/dockron
# secrets:
# - docker_username
# - docker_password
# tag:
# - ${docker_tag}
matrix: ---
include: kind: pipeline
- platform: linux/amd64 name: publish
docker_tag: latest
# - platform: linux/arm depends_on:
# docker_tag: linux-arm - test
trigger:
event:
- push
- tag
refs:
- refs/heads/master
- refs/tags/v*
workspace:
base: /go/src/dockron
steps:
- name: build
image: golang:1.11
commands:
- go get -u github.com/golang/dep/cmd/dep
- make build-all-static
- name: push image - amd64
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
- name: push image - arm
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
- name: push image - arm64
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=arm
- REPO=arm32v6
- 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

1
.gitignore vendored
View File

@ -26,5 +26,6 @@ _testmain.go
# Output # Output
dockron dockron
dockron-linux-*
# deps # deps
vendor/ vendor/

View File

@ -1,16 +1,21 @@
FROM golang:1.10 AS builder 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/
#
# RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -installsuffix nocgo -o dockron .
RUN go get -u github.com/golang/dep/cmd/dep FROM ${REPO}/busybox:latest
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 go build -a -installsuffix nocgo -o dockron .
FROM 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} ./dockron
CMD [ "./dockron" ] CMD [ "./dockron" ]

View File

@ -1,4 +1,4 @@
DOCKER_TAG ?= dockron-dev DOCKER_TAG ?= dockron-dev-${USER}
.PHONY: default .PHONY: default
default: build default: build
@ -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:
@ -37,8 +49,26 @@ dep-update:
.PHONY: docker-build .PHONY: docker-build
docker-build: docker-build:
docker build -t $(DOCKER_TAG) . docker build . -t ${DOCKER_TAG}-linux-amd64
# Cross build for arm architechtures
.PHONY: docker-cross-build-arm
docker-cross-build-arm:
docker build --build-arg REPO=arm32v6 --build-arg ARCH=arm . -t ${DOCKER_TAG}-linux-arm
.PHONY: docker-cross-build-arm
docker-cross-build-arm64:
docker build --build-arg REPO=arm64v8 --build-arg ARCH=arm64 . -t ${DOCKER_TAG}-linux-arm64
.PHONY: docker-run .PHONY: docker-run
docker-run: docker-run: docker-build
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --name $(DOCKER_TAG)-run $(DOCKER_TAG) docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --name $(DOCKER_TAG)-run $(DOCKER_TAG)-linux-amd64
# Cross run on host architechture
.PHONY: docker-cross-run-arm
docker-cross-run-arm: docker-cross-build-arm
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --name $(DOCKER_TAG)-run ${DOCKER_TAG}-linux-arm
.PHONY: docker-cross-run-arm64
docker-cross-run-arm64: docker-cross-build-arm64
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --name $(DOCKER_TAG)-run ${DOCKER_TAG}-linux-arm64

25
manifest.tmpl Normal file
View File

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