systemli / prometheus-jitsi-meet-exporter

Prometheus Exporter for Jitsi Meet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run go install inside docker image

Tinkesh-Kumar opened this issue · comments

Currently If you run go install from a mac machine and copy the files in Docker. Then service does not starts.

Error :- standard_init_linux.go:219: exec user process caused: exec format error

Suggestion

Run go install inside docker image.
Sample Docker file

# Start from the latest golang base image
FROM golang:latest

# Set the Current Working Directory inside the container
WORKDIR /app

# Copy all files
COPY . .

# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed

RUN go mod download
# Build the Go app
RUN go build -o prometheus-jitsi-meet-exporter .

# Expose port 8080 to the outside world
EXPOSE 9888

# Command to run the executable
ENTRYPOINT ["./prometheus-jitsi-meet-exporter"]

Why don't you use a multi-stage build? Now you are trying to run your prometheus exporter in the builder, it contains tons of things that are not necessary to run the exporter (image size goes from 2.5 MB to like 330 MB on x64 Linux, plus source/dashboards which the exporter doesn't need at runtime).

Why not just use the provided docker image? https://github.com/systemli/prometheus-jitsi-meet-exporter/blob/master/Dockerfile

EDIT: Also if it's an M1 Mac you need to use docker buildx if you plan on building x86 images locally: https://docs.docker.com/desktop/multi-arch/

You could build the exporter and docker image with goreleaser release --rm-dist --snapshot. Is this is sufficient for you?

EDIT: Also if it's an M1 Mac you need to use docker buildx if you plan on building x86 images locally: https://docs.docker.com/desktop/multi-arch/

Thanks for the update.