forked from stefanprodan/podinfo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.xx
52 lines (34 loc) · 1023 Bytes
/
Dockerfile.xx
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
ARG XX_VERSION=1.0.0-rc.2
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
FROM --platform=$BUILDPLATFORM golang:1.16-alpine as builder
# Copy the build utilities.
COPY --from=xx / /
ARG TARGETPLATFORM
ARG REVISION
RUN mkdir -p /podinfo/
WORKDIR /podinfo
COPY . .
RUN go mod download
ENV CGO_ENABLED=0
RUN xx-go build -ldflags "-s -w \
-X github.com/stefanprodan/podinfo/pkg/version.REVISION=${REVISION}" \
-a -o bin/podinfo cmd/podinfo/*
RUN xx-go build -ldflags "-s -w \
-X github.com/stefanprodan/podinfo/pkg/version.REVISION=${REVISION}" \
-a -o bin/podcli cmd/podcli/*
FROM alpine:3.14
ARG BUILD_DATE
ARG VERSION
ARG REVISION
LABEL maintainer="stefanprodan"
RUN addgroup -S app \
&& adduser -S -G app app \
&& apk --no-cache add \
ca-certificates curl netcat-openbsd
WORKDIR /home/app
COPY --from=builder /podinfo/bin/podinfo .
COPY --from=builder /podinfo/bin/podcli /usr/local/bin/podcli
COPY ./ui ./ui
RUN chown -R app:app ./
USER app
CMD ["./podinfo"]