mirror of
https://github.com/wahyd4/docker-hub-exporter.git
synced 2026-08-09 04:46:34 +10:00
Add new multi-stage Dockerfile for build
This commit is contained in:
+18
-6
@@ -1,10 +1,22 @@
|
||||
FROM python:3.6-alpine
|
||||
FROM golang:1.8.1-alpine as builder
|
||||
|
||||
RUN pip install prometheus_client requests
|
||||
WORKDIR /go/src/github.com/infinityworksltd/docker-hub-exporter/
|
||||
|
||||
ENV BIND_PORT 9170
|
||||
COPY ./ /go/src/github.com/infinityworksltd/docker-hub-exporter/
|
||||
|
||||
ADD . /usr/src/app
|
||||
WORKDIR /usr/src/app
|
||||
RUN apk --update add ca-certificates \
|
||||
&& apk --update add --virtual build-deps git
|
||||
|
||||
CMD ["python", "hub_exporter.py"]
|
||||
RUN go get \
|
||||
&& go test ./... \
|
||||
&& GOOS=linux go build -o app .
|
||||
|
||||
FROM alpine
|
||||
|
||||
RUN addgroup exporter \
|
||||
&& adduser -S -G exporter exporter \
|
||||
&& apk --update --no-cache add ca-certificates
|
||||
|
||||
COPY --from=builder /go/src/github.com/infinityworksltd/docker-hub-exporter/app .
|
||||
|
||||
ENTRYPOINT ["/app"]
|
||||
Reference in New Issue
Block a user