-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (33 loc) · 1.03 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
#############################################
# Build
#############################################
FROM --platform=$BUILDPLATFORM golang:1.23-alpine AS build
RUN apk upgrade --no-cache --force
RUN apk add --update build-base make git curl
WORKDIR /go/src/github.com/webdevops/helm-azure-tpl
# Dependencies
COPY go.mod go.sum .
RUN go mod download
COPY . .
RUN make test
# Compile
ARG TARGETARCH
RUN GOARCH=${TARGETARCH} make build
RUN chmod +x entrypoint.sh
#############################################
# Test
#############################################
FROM gcr.io/distroless/static AS test
USER 0:0
WORKDIR /app
COPY --from=build /go/src/github.com/webdevops/helm-azure-tpl/helm-azure-tpl .
COPY --from=build /go/src/github.com/webdevops/helm-azure-tpl/entrypoint.sh .
RUN ["./helm-azure-tpl", "--help"]
#############################################
# final
#############################################
FROM mcr.microsoft.com/azure-cli:latest AS final-azcli
WORKDIR /
COPY --from=test /app .
USER 1000:1000
ENTRYPOINT ["/entrypoint.sh"]