Skip to content

Commit

Permalink
Move both examples into single Dockerfile for Docker Hub (fixes prome…
Browse files Browse the repository at this point in the history
…theus#347)

Signed-off-by: Pedro Sland <[email protected]>
  • Loading branch information
pedrosland committed Jul 8, 2018
1 parent d6a9817 commit 516efb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
11 changes: 7 additions & 4 deletions examples/random/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
# docker build -f examples/$name/Dockerfile -t prometheus/golang-example-$name .

# Builder image, where we build the example.
FROM golang:1.9.0 AS builder
FROM golang:1.10.3 AS builder
WORKDIR /go/src/github.com/prometheus/client_golang
COPY . .
WORKDIR /go/src/github.com/prometheus/client_golang/prometheus
RUN go get -d
WORKDIR /go/src/github.com/prometheus/client_golang/examples/random
RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
WORKDIR /go/src/github.com/prometheus/client_golang/examples/simple
RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'

# Final image.
FROM scratch
FROM prom/busybox
LABEL maintainer "The Prometheus Authors <[email protected]>"
COPY --from=builder /go/src/github.com/prometheus/client_golang/examples/random .
COPY --from=builder /go/src/github.com/prometheus/client_golang/examples/random \
/go/src/github.com/prometheus/client_golang/examples/simple ./
EXPOSE 8080
ENTRYPOINT ["/random"]
CMD echo Please run an example. Either /random or /simple
20 changes: 0 additions & 20 deletions examples/simple/Dockerfile

This file was deleted.

0 comments on commit 516efb1

Please sign in to comment.