purpleidea / mgmt

Next generation distributed, event-driven, parallel config management!
https://purpleidea.com/tags/mgmtconfig/
GNU General Public License v3.0
3.65k stars 314 forks source link

Dockerfile fails to build binary #776

Closed jseifeddine closed 1 month ago

jseifeddine commented 1 month ago

I was following the quick start doc - building-from-a-container

Versions:

Description:

git clone --recursive https://github.com/purpleidea/mgmt/ ~/mgmt/
cd ~/mgmt
docker build -t mgmt -f docker/Dockerfile .
[+] Building 102.3s (10/10) FINISHED                                                                                                                                                                                                                                                                                                               docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                                                         0.0s
 => => transferring dockerfile: 569B                                                                                                                                                                                                                                                                                                                         0.0s
 => WARN: MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label (line 3)                                                                                                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/golang:1.21                                                                                                                                                                                                                                                                                               1.4s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                                                            0.0s
 => => transferring context: 47B                                                                                                                                                                                                                                                                                                                             0.0s
 => [1/6] FROM docker.io/library/golang:1.21@sha256:4746d26432a9117a5f58e95cb9f954ddf0de128e9d5816886514199316e4a2fb                                                                                                                                                                                                                                         0.0s
 => [internal] load build context                                                                                                                                                                                                                                                                                                                            0.4s
 => => transferring context: 13.96MB                                                                                                                                                                                                                                                                                                                         0.4s
 => CACHED [2/6] RUN apt-get update                                                                                                                                                                                                                                                                                                                          0.0s
 => CACHED [3/6] WORKDIR /go/src/mgmt                                                                                                                                                                                                                                                                                                                        0.0s
 => [4/6] COPY . /go/src/mgmt                                                                                                                                                                                                                                                                                                                                0.5s
 => [5/6] RUN make deps                                                                                                                                                                                                                                                                                                                                     98.3s
 => ERROR [6/6] RUN make build                                                                                                                                                                                                                                                                                                                               1.6s 
------                                                                                                                                                                                                                                                                                                                                                            
 > [6/6] RUN make build:                                                                                                                                                                                                                                                                                                                                          
1.282 Generating: lexer...                                                                                                                                                                                                                                                                                                                                        
1.514 Generating: parser...                                                                                                                                                                                                                                                                                                                                       
1.518 bash: line 1: goyacc: command not found                                                                                                                                                                                                                                                                                                                     
1.519 make[1]: *** [Makefile:47: parser/y.go] Error 127
1.520 make: *** [Makefile:206: lang] Error 2
------

 2 warnings found (use docker --debug to expand):
 - MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label (line 3)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 7)
Dockerfile:22
--------------------
  20 |     
  21 |     # Build the binary
  22 | >>> RUN make build
  23 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c make build" did not complete successfully: exit code: 2
purpleidea commented 1 month ago

I've never touched anything docker related, it was contributed and probably rotted, sorry.

I recommend building it from master without docker. Or you can download a release.

You are of course welcome to send patches for the docker things, but it's up to you.

Sorry about that.

purpleidea commented 1 month ago

1.518 bash: line 1: goyacc: command not found

Btw this is fairly easy to add: look in misc/make-deps.sh to see how we do it.

jseifeddine commented 1 month ago

Hey i got it working,

All it needed was a version bump, please adjust docker/Dockerfile to have FROM golang:1.23 instead of 1.21

Thanks :)