Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add scripts that rely on curl #49

Open
chrisbloemker opened this issue Mar 23, 2021 · 0 comments
Open

How to add scripts that rely on curl #49

chrisbloemker opened this issue Mar 23, 2021 · 0 comments

Comments

@chrisbloemker
Copy link

Hello,

I am curious what would be the best way to install packages like curl and jq for scripts like this:

- name: website_health
  script: curl -s -o /dev/null -w "%{http_code}" https://google.com
  timeout: 5

I know blackbox_exporter is more suited for this case but I am looking to do more advanced things like this such as curling an Elasticsearch endpoint and filter through json output for a value.

I have tried adding curl after the apk add statement where it installs bash but I receive the following error

------
 > [build-env 3/7] RUN go get -u github.com/prometheus/promu:
#9 6.835 package github.com/google/go-github/v25/github: cannot find package "github.com/google/go-github/v25/github" in any of:
#9 6.835 	/usr/local/go/src/github.com/google/go-github/v25/github (from $GOROOT)
#9 6.835 	/go/src/github.com/google/go-github/v25/github (from $GOPATH)
------
executor failed running [/bin/sh -c go get -u github.com/prometheus/promu]: exit code: 1

Here is my Dockerfile I am trying to build from:

FROM golang:1.14.1-alpine AS build-env

RUN apk add --update git gcc libc-dev
RUN go get -u github.com/prometheus/promu

RUN mkdir script_exporter
COPY .promu.yml script_exporter.go go.mod go.sum /go/script_exporter/

WORKDIR /go/script_exporter
RUN promu build

FROM alpine:3.11
LABEL upstream="https://github.com/adhocteam/script_exporter"
LABEL maintainer="james.kassemi@adhocteam.us"
RUN apk add --no-cache bash curl
COPY --from=build-env /go/script_exporter/script_exporter /bin/script-exporter
COPY script-exporter.yml /etc/script-exporter/config.yml

EXPOSE      9172
ENTRYPOINT  [ "/bin/script-exporter" ]
CMD ["-config.file=/etc/script-exporter/config.yml"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant