forked from burningalchemist/sql_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
32 lines (26 loc) · 825 Bytes
/
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
FROM golang:1.18 AS builder
ENV USER=app
ENV UID=10001
# See https://stackoverflow.com/a/55757473/12429735RUN
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
ADD . /go/src/github.com/a-monteiro/sql_exporter
WORKDIR /go/src/github.com/a-monteiro/sql_exporter
#RUN make drivers-custom
RUN make build
RUN chmod +x ./sql_exporter
# Make image and copy build sql_exporter
FROM scratch
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/src/github.com/a-monteiro/sql_exporter/sql_exporter /bin/sql_exporter
EXPOSE 9100
USER app:app
ENTRYPOINT [ "/bin/sql_exporter" ]