lacion / cookiecutter-golang

A Go project template
MIT License
690 stars 178 forks source link

make missing from gobuildimage #13

Closed paulwilljones closed 6 years ago

paulwilljones commented 6 years ago

Starting a vanilla cookiecutter-golang project $ make build

building gocrawler 0.1.0
GOPATH=/Users/pauljones/go
go build -ldflags "-X main.GitCommit=73b256979f7a3556c34009bd533d84e6bde743d6+CHANGES -X main.VersionPrerelease=DEV" -o bin/gocrawler

$ make package

Step 8/19 : RUN make build-alpine
 ---> Running in be127c896693
/bin/sh: make: not found
The command '/bin/sh -c make build-alpine' returned a non-zero code: 127

Looking in the Dockerfile is make installed in the build container?

lacion commented 6 years ago

i just gave this a test

$ cookiecutter https://github.com/lacion/cookiecutter-golang.git
You've downloaded /home/luismorales/.cookiecutters/cookiecutter-golang before. Is it okay to delete and re-download it? [yes]: 
full_name [Luis Morales]: 
github_username [lacion]: 
app_name [mygolangproject]: vanilla
project_short_description [A Golang project.]: vanillatest
docker_hub_username [lacion]: 
docker_image [lacion/docker-alpine:latest]: 
docker_build_image [lacion/docker-alpine:gobuildimage]: 
use_docker [y]: 
use_git [y]: 
use_logrus_logging [y]: 
use_viper_config [y]: 
Select use_ci:
1 - travis
2 - circle
3 - none
Choose from 1, 2, 3 [1]: 3
Initialized empty Git repository in /home/luismorales/Dropbox/Documents/Projects/lacion/test/vanilla/.git/
[master (root-commit) 963f403] Initial Commit.
 12 files changed, 599 insertions(+)
 create mode 100644 .circleci/config.yml
 create mode 100644 .gitignore
 create mode 100644 AUTHORS.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 Dockerfile
 create mode 100644 Gopkg.toml
 create mode 100644 Makefile
 create mode 100644 README.md
 create mode 100644 config/config.go
 create mode 100644 log/log.go
 create mode 100644 main.go
 create mode 100644 version.go

with this result

$ make package 
building image vanilla 0.1.0 963f403b905f4843f39d601ad5935b25b4cd508a
docker build --build-arg VERSION=0.1.0 --build-arg GIT_COMMIT=963f403b905f4843f39d601ad5935b25b4cd508a -t "lacion/vanilla":local .
Sending build context to Docker daemon  99.84kB
Step 1/19 : FROM lacion/docker-alpine:gobuildimage AS build-stage
 ---> b51f9688c28a
Step 2/19 : LABEL app="build-vanilla"
 ---> Running in f8a915d096e0
Removing intermediate container f8a915d096e0
 ---> c9319e27faf0
Step 3/19 : LABEL REPO="https://github.com/lacion/vanilla"
 ---> Running in 85ee12103301
Removing intermediate container 85ee12103301
 ---> a922f4aa700c
Step 4/19 : ENV PROJPATH=/go/src/github.com/lacion/vanilla
 ---> Running in ae9252260313
Removing intermediate container ae9252260313
 ---> f654a7d3f6c2
Step 5/19 : ENV PATH=$PATH:$GOROOT/bin:$GOPATH/bin
 ---> Running in cac227d64175
Removing intermediate container cac227d64175
 ---> da683dd2a5f0
Step 6/19 : ADD . /go/src/github.com/lacion/vanilla
 ---> bc203e746655
Step 7/19 : WORKDIR /go/src/github.com/lacion/vanilla
Removing intermediate container 020e859050b5
 ---> afda5f48b433
Step 8/19 : RUN make build-alpine
 ---> Running in d9f8e4b3a639
building vanilla 0.1.0
GOPATH=/go
go build -ldflags '-w -linkmode external -extldflags "-static" -X main.GitCommit=963f403b905f4843f39d601ad5935b25b4cd508a -X main.VersionPrerelease=VersionPrerelease=RC' -o bin/vanilla
Removing intermediate container d9f8e4b3a639
 ---> 23ac22fb7a12
Step 9/19 : FROM lacion/docker-alpine:latest
 ---> ea06f8b4c196
Step 10/19 : ARG GIT_COMMIT
 ---> Using cache
 ---> d0d95f0fa47e
Step 11/19 : ARG VERSION
 ---> Using cache
 ---> 494d960586f4
Step 12/19 : LABEL REPO="https://github.com/lacion/vanilla"
 ---> Running in 24d0c188dfc4
Removing intermediate container 24d0c188dfc4
 ---> 51929447fe1d
Step 13/19 : LABEL GIT_COMMIT=$GIT_COMMIT
 ---> Running in d675dc77a688
Removing intermediate container d675dc77a688
 ---> 19424e6c1416
Step 14/19 : LABEL VERSION=$VERSION
 ---> Running in 2908106b7ee5
Removing intermediate container 2908106b7ee5
 ---> 2072c3f1de3e
Step 15/19 : ENV PATH=$PATH:/opt/vanilla/bin
 ---> Running in d2055d62eaa6
Removing intermediate container d2055d62eaa6
 ---> 1a2bd340ec0a
Step 16/19 : WORKDIR /opt/vanilla/bin
Removing intermediate container 18d4ca6e7170
 ---> 4a55ee8de904
Step 17/19 : COPY --from=build-stage /go/src/github.com/lacion/vanilla/bin/vanilla /opt/vanilla/bin/
 ---> 32ed85516ac6
Step 18/19 : RUN chmod +x /opt/vanilla/bin/vanilla
 ---> Running in 2a003bc4bb7e
Removing intermediate container 2a003bc4bb7e
 ---> 039e85c67b0a
Step 19/19 : CMD /opt/vanilla/bin/vanilla
 ---> Running in 1ef86ee3a867
Removing intermediate container 1ef86ee3a867
 ---> a09c2858cbb6
Successfully built a09c2858cbb6
Successfully tagged lacion/vanilla:local

the build container does have make in it https://github.com/lacion/Docker-alpine/blob/gobuildimage/Dockerfile#L14