fluent / fluent-bit-go

Fluent Bit Golang package to build plugins
Apache License 2.0
189 stars 52 forks source link

docker build failure for examples/out_multiinstance/Dockerfile #40

Open frcai opened 3 years ago

frcai commented 3 years ago

Follow https://github.com/fluent/fluent-bit-go/tree/master/examples/out_multiinstance and hit No rule to make target 'all'.

~/fluent-bit-go$ sudo docker build . -t fluent-bit-multiinstance -f examples/out_multiinstance/Dockerfile Sending build context to Docker daemon 164.9kB Step 1/12 : FROM golang:1.14 as gobuilder ---> 21a5635903d6 Step 2/12 : WORKDIR /root ---> Using cache ---> cac906ec79de Step 3/12 : ENV GOOS=linux GOARCH=amd64 ---> Using cache ---> bf8c66726cbd Step 4/12 : COPY / /root/ ---> Using cache ---> 307205a0b494 Step 5/12 : RUN go mod edit -replace github.com/fluent/fluent-bit-go=github.com/fluent/fluent-bit-go@master ---> Using cache ---> a8571dbaaa4c Step 6/12 : RUN go mod download & make all ---> Running in 1ba930ea937b make: *** No rule to make target 'all'. Stop. The command '/bin/sh -c go mod download & make all' returned a non-zero code: 2

xiviu123 commented 3 years ago
all:
    go build -buildmode=c-shared -o out_multiinstance.so

check this line in make file

4fath commented 2 years ago

here, issue is build context and Dockerfile copy command. it copies into /root from build context which is not correct path for examples/out_multiinstance. what you can do is, changing your directory to examples/out_multiinstance and using followings in your Dockerfile:


RUN go mod download
RUN go build -buildmode=c-shared -o out_multiinstance.so