-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
59 lines (48 loc) · 2.01 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
55
56
57
58
59
ARG ALPINE_VERSION
ARG GOLANG_VERSION
FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} AS builder
RUN apk add --no-cache \
bash \
git \
upx
WORKDIR /build
COPY cmd/ go.mod go.sum ./
RUN go mod download
ARG TARGETARCH
ARG CGO_ENABLED=0
ARG GOOS=linux
ARG GOARCH=${TARGETARCH}
RUN go test -v . && \
go build -a -ldflags="-s -w" \
-o sidecar-controller . && \
upx -9 sidecar-controller
ARG ALPINE_VERSION
FROM alpine:${ALPINE_VERSION}
ARG ALPINE_VERSION
ARG GOLANG_VERSION
ARG CONTAINER_VERSION
ARG COMMIT_SHA
LABEL org.opencontainers.image.authors="Wallarm Support Team <[email protected]>"
LABEL org.opencontainers.image.title="Kubernetes Sidecar controller of Wallarm API Security deployment"
LABEL org.opencontainers.image.documentation="https://docs.wallarm.com/installation/kubernetes/sidecar-proxy/deployment/"
LABEL org.opencontainers.image.source="https://github.com/wallarm/sidecar"
LABEL org.opencontainers.image.vendor="Wallarm"
LABEL org.opencontainers.image.version="${CONTAINER_VERSION}"
LABEL org.opencontainers.image.revision="${COMMIT_SHA}"
LABEL com.wallarm.sidecar-controller.versions.alpine="${ALPINE_VERSION}"
LABEL com.wallarm.sidecar-controller.versions.golang="${GOLANG_VERSION}"
ARG UID=65222
ARG GID=65222
RUN apk update && \
apk upgrade && \
apk add --no-cache \
bash && \
addgroup -g ${GID} controller && \
adduser -h /home/controller \
-s /bin/bash -u ${UID} -D \
-G controller \
controller
COPY --from=builder /build/sidecar-controller /usr/local/bin/sidecar-controller
COPY --chown=${UID}:${GID} files/template.yaml.tpl /etc/controller/template.yaml.tpl
USER ${UID}:${GID}
ENTRYPOINT ["sidecar-controller"]