WIP: Mutli-stage build not working
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
44a54f1c7f
commit
0791c6afa3
15
Dockerfile
15
Dockerfile
@ -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
|
||||||
|
|
||||||
|
16
Dockerfile.multi-stage
Normal file
16
Dockerfile.multi-stage
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
ARG REPO=library
|
||||||
|
FROM ${REPO}/golang:1.11-alpine AS builder
|
||||||
|
|
||||||
|
COPY ./go.mod ./go.sum /go/src/app/
|
||||||
|
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
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 .
|
||||||
|
|
||||||
|
CMD [ "./dockron" ]
|
18
Makefile
18
Makefile
@ -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
|
||||||
@ -36,17 +36,13 @@ build-all-static: dockron-linux-amd64 dockron-linux-arm dockron-linux-arm64
|
|||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm dockron
|
rm dockron
|
||||||
|
rm 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
15
go.mod
Normal 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
18
go.sum
Normal 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…
Reference in New Issue
Block a user