user2128514
user2128514

Reputation: 47

airflow exporter - binary build dockerfile error

When I build binary and package to alpine image for airflow exporter with my Dockerfile I am getting error.

Not sure how to fix this error.

+++++ Error while docker build +++++++++

---> Running in caebfe9a04a0
stat mage.go: no such file or directory
The command '/bin/sh -c cd /go/src/github.com/airflow_exporter/; go run mage.go binary' returned a non-zero code: 1

+++++++++++++++

++++++++++++++++ My Dockerfile +++++++++++++++++

FROM golang:1.11.1 AS builder
RUN mkdir -p /go/src/github.com/airflow_exporter
ADD . /go/src/github.com/airflow_exporter
RUN cd /go/src/github.com/airflow_exporter/; 
go run mage.go binary

FROM alpine:3.4
COPY --from=builder /go/src/github.com/airflow_exporter/bin/*/airflow_exporter /airflow_exporter
EXPOSE 9112
ENTRYPOINT [ "/airflow_exporter" ]

+++++++++++++++++++++++++++++++++

Upvotes: 0

Views: 68

Answers (1)

gdexlab
gdexlab

Reputation: 199

The first line in your docker build output shows that the binary file mage.go is not in the expected location (stat mage.go: no such file or directory). Check through the steps that lead up to reading that binary. I would look through the following:

  1. Check that the directory from which your docker file is being run actually contains the mage.go binary, since you are adding the contents of your pwd to the airflow_exporter (ADD . /go/src/github.com/airflow_exporter)
  2. Try adding the full file path to mage.go
  3. If the above fails, try running your own stat commands on the file throughout the process, and continue breaking down the problem from there

Upvotes: 1

Related Questions