Switch to go mod instead of dep

This commit is contained in:
IamTheFij 2019-06-07 17:08:15 -07:00
parent 33c945536a
commit 0e44c6e2cf
6 changed files with 60 additions and 33 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,15 +22,11 @@ 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-linux-static
- name: push image - arm - name: push image - arm
image: plugins/docker image: plugins/docker

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

@ -8,11 +8,11 @@ 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
@ -53,18 +53,14 @@ build-all-static: dockron-darwin-amd64 build-linux-static
# 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=