forked from skupperproject/skupper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.network-observer
More file actions
45 lines (33 loc) · 1.26 KB
/
Dockerfile.network-observer
File metadata and controls
45 lines (33 loc) · 1.26 KB
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
ARG GO_IMAGE_BASE_TAG=1.25
ARG CONSOLE_VERSION=development
FROM --platform=$BUILDPLATFORM golang:${GO_IMAGE_BASE_TAG} AS builder
ARG TARGETARCH
ARG CONSOLE_VERSION
RUN apt-get update && apt-get install -y jq wget && rm -rf /var/lib/apt/lists/*
WORKDIR /go/src/app
COPY go.mod .
COPY go.sum .
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY . .
ENV CGO_ENABLED=0
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
make -B GOARCH=$TARGETARCH build-network-observer
# Download console release
WORKDIR /console
RUN wget --progress=dot:giga -O /tmp/console.tgz \
"https://github.com/skupperproject/skupper-console/releases/download/${CONSOLE_VERSION}/console.tgz" && \
tar -xzf /tmp/console.tgz && rm /tmp/console.tgz
# Use scratch for minimal image size
FROM scratch
LABEL \
org.opencontainers.image.title="Skupper Network Observer" \
org.opencontainers.image.description="Exposes Skupper network telemetry through an API, metrics and a web console"
WORKDIR /app
# Copy the statically linked binary
COPY --from=builder /go/src/app/network-observer .
COPY --from=builder /console/ console
# Use numeric user ID (no need to create user in scratch)
USER 10000
ENTRYPOINT ["/app/network-observer"]