thoas / picfit

An image resizing server written in Go
http://bit.ly/1E7rSoi
MIT License
2.14k stars 177 forks source link

Docker build does not work #127

Closed tylermenezes closed 4 years ago

tylermenezes commented 4 years ago

The image used for Docker doesn't seem to support the binary build from make docker-build:

> make docker-build && docker build . -t picfit:latest && docker run -it picfit:latest
-> Preparing builder...
Sending build context to Docker daemon  330.5MB
Step 1/4 : FROM golang:1.12.5
 ---> 1ef078f0da9e
Step 2/4 : ADD . /go/src/github.com/thoas/picfit
 ---> de01953c960e
Step 3/4 : WORKDIR /go/src/github.com/thoas/picfit
 ---> Running in 35f4baabd553
Removing intermediate container 35f4baabd553
 ---> 5774c6683728
Step 4/4 : CMD make docker-build-static
 ---> Running in 458a22f303d5
Removing intermediate container 458a22f303d5
 ---> d6b096761777
Successfully built d6b096761777
Successfully tagged picfit-builder:latest
-> Creating statically linked binary...
mkdir -p /go/src/github.com/thoas/picfit/bin
go build -mod=vendor -ldflags "\
    -X github.com/thoas/picfit/constants.Branch= \
    -X github.com/thoas/picfit/constants.Revision= \
    -X 'github.com/thoas/picfit/constants.BuildTime=2020-03-31 22:54:34 UTC+0000' \
    -X 'github.com/thoas/picfit/constants.Compiler=go version go1.12.5 linux/amd64'" -a -installsuffix cgo -o /go/src/github.com/thoas/picfit/bin/picfit ./cmd/picfit/main.go
Sending build context to Docker daemon    380MB
Step 1/4 : FROM alpine:3.7
 ---> 6d1ef012b567
Step 2/4 : RUN apk add --no-cache ca-certificates
 ---> Using cache
 ---> 9315829c8fc8
Step 3/4 : ADD bin/picfit /picfit
 ---> 3c5e3a40f657
Step 4/4 : CMD ["/picfit"]
 ---> Running in 8181ab78815f
Removing intermediate container 8181ab78815f
 ---> 95a03b71fbf7
Successfully built 95a03b71fbf7
Successfully tagged picfit:latest
standard_init_linux.go:207: exec user process caused "no such file or directory"