forked from foomo/pagespeed_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (29 loc) · 1.09 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -----------------------------------------------------------------------------
# Builder Base
# -----------------------------------------------------------------------------
FROM golang:alpine as base
MAINTAINER Stefan Martinov <[email protected]>
RUN apk add --no-cache git make bash upx \
&& rm -rf /var/cache/apk/*
WORKDIR /app
COPY ./go.mod ./go.sum ./
RUN go mod download
COPY . ./
##############################
###### STAGE: BUILD ######
##############################
FROM base as builder
MAINTAINER Stefan Martinov <[email protected]>
RUN go build -ldflags "-X main.Version=`git rev-parse --short HEAD`" -o /pagespeed_exporter pagespeed_exporter.go
# strip and compress the binary
RUN upx /pagespeed_exporter
##############################
###### STAGE: PACKAGE ######
##############################
FROM alpine
MAINTAINER Stefan Martinov <[email protected]>
COPY --from=builder /pagespeed_exporter /bin/pagespeed_exporter
RUN apk update \
&& apk --no-cache add ca-certificates
EXPOSE 9271
ENTRYPOINT [ "/bin/pagespeed_exporter" ]