Compare commits

...

6 Commits

Author SHA1 Message Date
d1ece2e4e6 Update drone static builds
Some checks reported errors
continuous-integration/drone/push Build was killed
2019-08-14 10:04:39 -07:00
c20e1a36b3 Same
Some checks failed
continuous-integration/drone/push Build is failing
2019-08-09 18:09:41 -07:00
2f50ab66ee Change working dir to outside go path
Some checks failed
continuous-integration/drone/push Build is failing
2019-08-09 18:07:22 -07:00
70a8330d64 Remove dep from drone pipeline
Some checks failed
continuous-integration/drone/push Build is failing
2019-08-09 18:06:22 -07:00
0d332b2f05 Fix multi-stage builds 2019-08-09 18:05:17 -07:00
0791c6afa3 WIP: Mutli-stage build not working
Some checks failed
continuous-integration/drone/push Build is failing
2019-06-07 17:08:15 -07:00
6 changed files with 63 additions and 36 deletions

View File

@ -1,14 +1,10 @@
kind: pipeline kind: pipeline
name: test name: test
workspace:
base: /go/src/dockron
steps: steps:
- name: build - name: build
image: golang:1.11 image: golang:1.12
commands: commands:
- go get -u github.com/golang/dep/cmd/dep
- make build - make build
--- ---
@ -26,14 +22,10 @@ trigger:
- refs/heads/master - refs/heads/master
- refs/tags/v* - refs/tags/v*
workspace:
base: /go/src/dockron
steps: steps:
- name: build - name: build
image: golang:1.11 image: golang:1.12
commands: commands:
- go get -u github.com/golang/dep/cmd/dep
- make build-all-static - make build-all-static
- name: push image - arm - name: push image - arm

View File

@ -1,20 +1,7 @@
ARG REPO=library 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 .
FROM ${REPO}/busybox:latest FROM ${REPO}/busybox:latest
WORKDIR /root/ WORKDIR /root/
# COPY --from=builder /go/src/app/dockron .
ARG ARCH=amd64 ARG ARCH=amd64
COPY ./dockron-linux-${ARCH} ./dockron COPY ./dockron-linux-${ARCH} ./dockron

19
Dockerfile.multi-stage Normal file
View File

@ -0,0 +1,19 @@
ARG REPO=library
FROM ${REPO}/golang:1.12-alpine AS builder
RUN apk add --no-cache git
RUN mkdir /app
WORKDIR /app
COPY ./go.mod ./go.sum /app/
RUN go mod download
COPY ./main.go /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 /app/dockron .
CMD [ "./dockron" ]

View File

@ -5,28 +5,28 @@ default: build
# Downloads dependencies into vendor directory # Downloads dependencies into vendor directory
vendor: vendor:
dep ensure go mod vendor
# Runs the application, useful while developing # Runs the application, useful while developing
.PHONY: run .PHONY: run
run: vendor run:
go run *.go go run *.go
# Output target # Output target
dockron: vendor dockron:
go build -o dockron go build -o dockron
# Alias for building # Alias for building
.PHONY: build .PHONY: build
build: dockron build: dockron
dockron-linux-amd64: vendor dockron-linux-amd64:
GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o dockron-linux-amd64 GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o dockron-linux-amd64
dockron-linux-arm: vendor dockron-linux-arm:
GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o dockron-linux-arm GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o dockron-linux-arm
dockron-linux-arm64: vendor dockron-linux-arm64:
GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o dockron-linux-arm64 GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o dockron-linux-arm64
.PHONY: build-all-static .PHONY: build-all-static
@ -35,18 +35,14 @@ 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:
rm dockron rm -f dockron
rm -f dockron-linux-*
# Cleans vendor directory # Cleans vendor directory
.PHONY: clean-vendor .PHONY: clean-vendor
clean-vendor: clean-vendor:
rm -fr ./vendor rm -fr ./vendor
# Attempts to update dependencies
.PHONY: dep-update
dep-update:
dep ensure -update
.PHONY: docker-build .PHONY: docker-build
docker-build: docker-build:
docker build . -t ${DOCKER_TAG}-linux-amd64 docker build . -t ${DOCKER_TAG}-linux-amd64

15
go.mod Normal file
View File

@ -0,0 +1,15 @@
module github.com/iamthefij/dockron
go 1.12
require (
github.com/Microsoft/go-winio v0.4.9 // indirect
github.com/docker/distribution v2.6.2+incompatible // indirect
github.com/docker/docker v1.13.1
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.3.3 // indirect
github.com/pkg/errors v0.8.0 // indirect
github.com/robfig/cron v1.1.0
golang.org/x/net v0.0.0-20180801234040-f4c29de78a2a
golang.org/x/sys v0.0.0-20180802203216-0ffbfd41fbef // indirect
)

18
go.sum Normal file
View File

@ -0,0 +1,18 @@
github.com/Microsoft/go-winio v0.4.9 h1:3RbgqgGVqmcpbOiwrjbVtDHLlJBGF6aE+yHmNtBNsFQ=
github.com/Microsoft/go-winio v0.4.9/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
github.com/docker/distribution v2.6.2+incompatible h1:4FI6af79dfCS/CYb+RRtkSHw3q1L/bnDjG1PcPZtQhM=
github.com/docker/distribution v2.6.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo=
github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk=
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/robfig/cron v1.1.0 h1:jk4/Hud3TTdcrJgUOBgsqrZBarcxl6ADIjSC2iniwLY=
github.com/robfig/cron v1.1.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
golang.org/x/net v0.0.0-20180801234040-f4c29de78a2a h1:8fCF9zjAir2SP3N+axz9xs+0r4V8dqPzqsWO10t8zoo=
golang.org/x/net v0.0.0-20180801234040-f4c29de78a2a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sys v0.0.0-20180802203216-0ffbfd41fbef h1:ESfhYoBNk2UQGmavscFPKfwmc4ZTB2+UdQYsVw6Bq9M=
golang.org/x/sys v0.0.0-20180802203216-0ffbfd41fbef/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=