Browse Source

Switch to go mod instead of dep

tags/v1.0.1
IamTheFij 3 months ago
parent
commit
0e44c6e2cf
6 changed files with 60 additions and 33 deletions
  1. 3
    11
      .drone.yml
  2. 1
    14
      Dockerfile
  3. 19
    0
      Dockerfile.multi-stage
  4. 4
    8
      Makefile
  5. 15
    0
      go.mod
  6. 18
    0
      go.sum

+ 3
- 11
.drone.yml View File

@@ -1,14 +1,10 @@
kind: pipeline
name: test

workspace:
base: /go/src/dockron

steps:
- name: build
image: golang:1.11
image: golang:1.12
commands:
- go get -u github.com/golang/dep/cmd/dep
- make build

---
@@ -26,15 +22,11 @@ trigger:
- refs/heads/master
- refs/tags/v*

workspace:
base: /go/src/dockron

steps:
- name: build
image: golang:1.11
image: golang:1.12
commands:
- go get -u github.com/golang/dep/cmd/dep
- make build-linux-static
- make build-all-static

- name: push image - arm
image: plugins/docker

+ 1
- 14
Dockerfile View File

@@ -1,20 +1,7 @@
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
WORKDIR /root/
# COPY --from=builder /go/src/app/dockron .

ARG ARCH=amd64
COPY ./dockron-linux-${ARCH} ./dockron


+ 19
- 0
Dockerfile.multi-stage 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" ]

+ 4
- 8
Makefile View File

@@ -8,11 +8,11 @@ default: build

# Downloads dependencies into vendor directory
vendor:
dep ensure
go mod vendor

# Runs the application, useful while developing
.PHONY: run
run: vendor
run:
go run *.go

# Output target
@@ -53,18 +53,14 @@ build-all-static: dockron-darwin-amd64 build-linux-static
# Cleans all build artifacts
.PHONY: clean
clean:
rm dockron
rm -f dockron
rm -f dockron-linux-*

# Cleans vendor directory
.PHONY: clean-vendor
clean-vendor:
rm -fr ./vendor

# Attempts to update dependencies
.PHONY: dep-update
dep-update:
dep ensure -update

.PHONY: docker-build
docker-build:
docker build . -t ${DOCKER_TAG}-linux-amd64

+ 15
- 0
go.mod 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
- 0
go.sum 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=

Loading…
Cancel
Save