mittwald/kube-httpcache

Image could not be built

dealancer opened this issue · 3 comments

Describe the bug
Not able to build image using Dockerfile provided.

To Reproduce
Steps to reproduce the behavior:

➜  kube-httpcache git:(master) docker build -t test build/package/docker/

[+] Building 28.8s (12/16)                                                                                                             
 => [internal] load build definition from Dockerfile                                                                              0.0s
 => => transferring dockerfile: 2.06kB                                                                                            0.0s
 => [internal] load .dockerignore                                                                                                 0.0s
 => => transferring context: 2B                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/debian:stretch-slim                                                            1.1s
 => [internal] load metadata for docker.io/library/golang:1.14                                                                    1.1s
 => https://github.com/jonnenauha/prometheus_varnish_exporter/releases/download/1.6/prometheus_varnish_exporter-1.6.linux-amd64.  0.0s
 => [final 1/7] FROM docker.io/library/debian:stretch-slim@sha256:828b649e84b713d1b11a1bcf88e832625e99d74aecfeeb5bec1b0846bb40dc  5.1s
 => => resolve docker.io/library/debian:stretch-slim@sha256:828b649e84b713d1b11a1bcf88e832625e99d74aecfeeb5bec1b0846bb40dce1      0.0s
 => => sha256:828b649e84b713d1b11a1bcf88e832625e99d74aecfeeb5bec1b0846bb40dce1 1.21kB / 1.21kB                                    0.0s
 => => sha256:f3bacc9654b39a1aead2b3ec694ad449817b71d53566fd08c4dcd21ac38d12f8 529B / 529B                                        0.0s
 => => sha256:e59fcdf363c23ddb2d02f3297cc4a330f342b9d5da45132a4774494175732b1c 1.46kB / 1.46kB                                    0.0s
 => => sha256:fa1690ae92289fb310aa27b793a164bf8bbedc7ddd00ca079a31bb8bb315b616 22.53MB / 22.53MB                                  3.6s
 => => extracting sha256:fa1690ae92289fb310aa27b793a164bf8bbedc7ddd00ca079a31bb8bb315b616                                         1.4s
 => [internal] load build context                                                                                                 0.0s
 => => transferring context: 3.20kB                                                                                               0.0s
 => [builder 1/4] FROM docker.io/library/golang:1.14@sha256:1a7173b5b9a3af3e29a5837e0b2027e1c438fd1b83bbee8f221355087ad416d6     26.2s
 => => resolve docker.io/library/golang:1.14@sha256:1a7173b5b9a3af3e29a5837e0b2027e1c438fd1b83bbee8f221355087ad416d6              0.0s
 => => sha256:1a7173b5b9a3af3e29a5837e0b2027e1c438fd1b83bbee8f221355087ad416d6 2.36kB / 2.36kB                                    0.0s
 => => sha256:6a39a02f74ffee82a169f2d836134236dc6f69e5946779da13deb3c7c6fedafd 1.79kB / 1.79kB                                    0.0s
 => => sha256:21a5635903d69da3c3d928ed429e3610eecdf878cbd763aabf5db9693016ffbb 7.03kB / 7.03kB                                    0.0s
 => => sha256:0ecb575e629cd60aa802266a3bc6847dcf4073aa2a6d7d43f717dd61e7b90e0b 50.40MB / 50.40MB                                  9.2s
 => => sha256:7467d1831b6947c294d92ee957902c3cd448b17c5ac2103ca5e79d15afb317c3 7.83MB / 7.83MB                                    1.6s
 => => sha256:feab2c490a3cea21cc051ff29c33cc9857418edfa1be9966124b18abe1d5ae16 10.00MB / 10.00MB                                  3.4s
 => => sha256:f15a0f46f8c38f4ca7daecf160ba9cdb3ddeafda769e2741e179851cfaa14eec 51.83MB / 51.83MB                                 10.4s
 => => sha256:1517911a35d7939f446084c1d4c31afc552678e81b3450c2af998b57f72099c2 68.72MB / 68.72MB                                 13.1s
 => => sha256:48bbd1746d63c372e12f884178053851d87f3ea4b415f3d5e7d4eceb9aab6baf 124.14MB / 124.14MB                               19.8s
 => => extracting sha256:0ecb575e629cd60aa802266a3bc6847dcf4073aa2a6d7d43f717dd61e7b90e0b                                         3.0s
 => => sha256:944903612fdd2364b4647cf3c231c41103d1fd378add43fc85f6931f1d6a8276 126B / 126B                                       10.5s
 => => extracting sha256:7467d1831b6947c294d92ee957902c3cd448b17c5ac2103ca5e79d15afb317c3                                         0.4s
 => => extracting sha256:feab2c490a3cea21cc051ff29c33cc9857418edfa1be9966124b18abe1d5ae16                                         0.3s
 => => extracting sha256:f15a0f46f8c38f4ca7daecf160ba9cdb3ddeafda769e2741e179851cfaa14eec                                         3.2s
 => => extracting sha256:1517911a35d7939f446084c1d4c31afc552678e81b3450c2af998b57f72099c2                                         3.5s
 => => extracting sha256:48bbd1746d63c372e12f884178053851d87f3ea4b415f3d5e7d4eceb9aab6baf                                         5.5s
 => => extracting sha256:944903612fdd2364b4647cf3c231c41103d1fd378add43fc85f6931f1d6a8276                                         0.0s
 => CANCELED [final 2/7] RUN         set -x             &&             apt-get -qq update && apt-get -qq upgrade             &&  22.5s
 => [builder 2/4] WORKDIR     /workspace                                                                                          1.0s
 => [builder 3/4] COPY        . .                                                                                                 0.0s
 => ERROR [builder 4/4] RUN         CGO_ENABLED=0 GOOS=linux             go build                 -installsuffix cgo              0.3s
------                                                                                                                                 
 > [builder 4/4] RUN         CGO_ENABLED=0 GOOS=linux             go build                 -installsuffix cgo                 -o kube-httpcache                 -a cmd/kube-httpcache/main.go:                                                                                
#15 0.266 can't load package: package cmd/kube-httpcache/main.go: cannot find package "cmd/kube-httpcache/main.go" in any of:          
#15 0.266       /usr/local/go/src/cmd/kube-httpcache/main.go (from $GOROOT)                                                            
#15 0.266       /go/src/cmd/kube-httpcache/main.go (from $GOPATH)                                                                      
------
executor failed running [/bin/sh -c CGO_ENABLED=0 GOOS=linux             go build                 -installsuffix cgo                 -o kube-httpcache                 -a cmd/kube-httpcache/main.go]: exit code: 1

Expected behavior
Image should be built.

Environment:

  • kube-httpcache version: master

There has not been any activity to this issue in the last 14 days. It will automatically be closed after 7 more days. Remove the stale label to prevent this.

Thanks for the report, and sorry for the late reaction. I was able to reproduce this issue.

The build context (aka the first non-flag argument to docker build) still needs to be the repository root. To just use a different Dockerfile, use the -f flag for docker build:

$ docker build -t test -f build/package/docker/Dockerfile .

I'll see if we can mention this in the README.