-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
63 lines (47 loc) · 1.71 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
60
61
62
63
FROM golang:1.23.2-alpine AS backendbuilder
RUN apk add --no-cache build-base git bash
ENV WORKDIR=/k8s-ces-control
RUN mkdir -p ${WORKDIR}
WORKDIR ${WORKDIR}
COPY go.mod go.sum ${WORKDIR}/
RUN go mod download
## Copy golang source code
COPY main.go ${WORKDIR}/
COPY interfaces.go ${WORKDIR}/
COPY packages ${WORKDIR}/packages
COPY .git ${WORKDIR}/.git
## Copy makefiles
COPY Makefile ${WORKDIR}/
COPY makefiles ${WORKDIR}/makefiles
COPY build ${WORKDIR}/build
RUN go mod vendor
RUN make compile-generic
FROM alpine:20221110
RUN apk add --no-cache git bash
ENV WORKDIR=/k8s-ces-control
RUN mkdir -p ${WORKDIR}
WORKDIR ${WORKDIR}
LABEL maintainer="[email protected]" \
NAME="k8s-ces-control" \
VERSION="1.2.1"
COPY --from=backendbuilder /k8s-ces-control/target/k8s-ces-control ${WORKDIR}/k8s-ces-control
ENV USER=k8s-ces-control \
GRPC_HEALTH_PROBE_VERSION=0.4.36
RUN set -eux -o pipefail \
&& apk update \
&& apk upgrade \
&& addgroup -S -g 1000 "${USER}" \
&& adduser -S -h ${WORKDIR} -G "${USER}" -u 1000 -s /bin/bash "${USER}" \
&& chown -R ${USER}:${USER} ${WORKDIR} /etc/ssl/certs \
&& rm -rf /var/cache/apk/*
# Install grpc health probe cli tool to be used to verify the readiness of our app
RUN wget -O /grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 \
&& chmod +x /grpc_health_probe
# Create folder for k8s-ces-control files.
RUN mkdir /etc/k8s-ces-control \
&& chown -R ${USER}:${USER} /etc/k8s-ces-control
EXPOSE 50051
#HEALTHCHECK CMD /grpc_health_probe -tls -tulpn | grep LISTEN | grep 50051
WORKDIR ${WORKDIR}
USER k8s-ces-control
CMD LOG_LEVEL=DEBUG ./k8s-ces-control start