From 666a63e114f649a003ac2035c9e4c17b50dab412 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 15 May 2019 04:57:25 +0200 Subject: [PATCH] [GH-8] docker image could not be built due to missing files --- Dockerfile | 15 ++++++--------- go.mod | 3 ++- go.sum | 7 +++++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index d356c2df..ef95c7f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,16 @@ FROM golang:1.12.4-alpine as builder -RUN mkdir n3dr && \ - adduser -D -g '' n3dr -COPY main.go go.mod go.sum ./n3dr/ -COPY cli ./n3dr/cli +COPY . ./n3dr/ WORKDIR n3dr -RUN ls && \ +RUN adduser -D -g '' n3dr && \ apk add git && \ - ls && \ CGO_ENABLED=0 go build && \ - ls && \ - cp n3dr /n3dr + cp n3dr /n3dr && \ + chmod 100 /n3dr FROM scratch +COPY --from=builder /etc/group /etc/group COPY --from=builder /etc/passwd /etc/passwd -COPY --from=builder /n3dr /usr/local/n3dr +COPY --from=builder --chown=n3dr:n3dr /n3dr /usr/local/n3dr COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ USER n3dr ENTRYPOINT ["/usr/local/n3dr"] diff --git a/go.mod b/go.mod index 09cc3c4f..2714fb17 100644 --- a/go.mod +++ b/go.mod @@ -4,8 +4,9 @@ go 1.12 require ( github.com/030/go-utils v0.0.0-20190427204242-b7d6df265912 + github.com/BurntSushi/toml v0.3.1 // indirect github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a - github.com/cloudflare/cfssl v0.0.0-20190510060611-9c027c93ba9e + github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/mitchellh/go-homedir v1.1.0 github.com/sirupsen/logrus v1.4.1 github.com/spf13/cobra v0.0.3 diff --git a/go.sum b/go.sum index 73669e49..20de7bc6 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,10 @@ github.com/030/go-utils v0.0.0-20190427204242-b7d6df265912 h1:MdgRWx8epGSKbQYxR/kEzmQkUHQCiB8gNlM+QDwiivM= github.com/030/go-utils v0.0.0-20190427204242-b7d6df265912/go.mod h1:HQbQNpJnmYGDC3WTdKeB5cslJFbZ78Cr+KTEZcJTi4o= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/cloudflare/cfssl v0.0.0-20190510060611-9c027c93ba9e h1:ZtyhUG4s94BMUCdgvRZySr/AXYL5CDcjxhIV/83xJog= -github.com/cloudflare/cfssl v0.0.0-20190510060611-9c027c93ba9e/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -14,6 +14,8 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= @@ -56,6 +58,7 @@ golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a h1:1n5lsVfiQW3yfsRGu98756EH1 golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=