-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (38 loc) · 1.33 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
43
44
45
46
47
48
49
50
51
52
53
54
###############################################################################
# BEGIN build-stage
# Compile the binary
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.23.0 AS build-stage
ARG BUILDPLATFORM
ARG TARGETARCH
ARG RELEASE_VERSION
WORKDIR /app
COPY vendor ./vendor
COPY go.mod go.sum ./
COPY cmd ./cmd
COPY pkg ./pkg
COPY hack ./hack
RUN --mount=type=bind,target=/app/.git,source=.git GOOS=linux GOARCH="${TARGETARCH}" hack/build.sh
#
# END build-stage
###############################################################################
###############################################################################
# BEGIN combine-stage
# Combine all outputs, to enable single layer copy for the final image
FROM scratch AS combine-stage
COPY --from=build-stage /app/bin/speedtest-exporter /
COPY --from=build-stage /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
#
# END combine-stage
###############################################################################
###############################################################################
# BEGIN final-stage
# Create final docker image
FROM scratch AS final-stage
WORKDIR /
COPY --from=combine-stage / /
EXPOSE 8080
USER 1001
ENTRYPOINT ["/speedtest-exporter"]
#
# END final-stage
###############################################################################