Skip to content
Snippets Groups Projects
Commit 8c89e535 authored by Pierre Mdawar's avatar Pierre Mdawar
Browse files

[Dockerfile] add new alpine build stage

parent 1b148d98
No related branches found
No related tags found
No related merge requests found
#
# build container
#
FROM golang:1-alpine
FROM golang:1-alpine as builder
WORKDIR /go/src/github.com/oliver006/redis_exporter/
 
ADD main.go /go/src/github.com/oliver006/redis_exporter/
Loading
Loading
@@ -20,15 +20,25 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o /redis_exporter \
-ldflags "-s -w -extldflags \"-static\" -X main.VERSION=$TAG -X main.COMMIT_SHA1=$SHA1 -X main.BUILD_DATE=$DATE" .
 
 
#
# Alpine release container
#
FROM alpine as alpine
COPY --from=builder /redis_exporter /redis_exporter
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
EXPOSE 9121
ENTRYPOINT [ "/redis_exporter" ]
 
 
#
# release container
#
FROM scratch
FROM scratch as scratch
 
COPY --from=0 /redis_exporter /redis_exporter
COPY --from=0 /etc/ssl/certs /etc/ssl/certs
COPY --from=builder /redis_exporter /redis_exporter
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
 
EXPOSE 9121
ENTRYPOINT [ "/redis_exporter" ]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment