-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
50 lines (42 loc) · 1.28 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
#############################################
# Build
#############################################
FROM --platform=$BUILDPLATFORM golang:1.23-alpine as build
RUN apk upgrade --no-cache --force
RUN apk add --update build-base make git
WORKDIR /go/src/github.com/webdevops/azure-auditor
# Dependencies
COPY go.mod go.sum .
RUN go mod download
# Compile
COPY . .
RUN make test
ARG TARGETOS TARGETARCH
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} make build
#############################################
# Test
#############################################
FROM gcr.io/distroless/static as test
USER 0:0
WORKDIR /app
COPY --from=build /go/src/github.com/webdevops/azure-auditor/azure-auditor .
COPY --from=build /go/src/github.com/webdevops/azure-auditor/templates ./templates
RUN ["./azure-auditor", "--help"]
#############################################
# final-azcli
#############################################
FROM mcr.microsoft.com/azure-cli as final-azcli
ENV LOG_JSON=1
WORKDIR /
COPY --from=test /app .
USER 1000:1000
ENTRYPOINT ["/azure-auditor"]
#############################################
# final-static
#############################################
FROM gcr.io/distroless/static as final-static
ENV LOG_JSON=1
WORKDIR /
COPY --from=test /app .
USER 1000:1000
ENTRYPOINT ["/azure-auditor"]