Skip to content

Commit 7c9c9e4

Browse files
CR-3159 run rootless (#224)
* rootless
1 parent fa04af2 commit 7c9c9e4

File tree

5 files changed

+33
-7
lines changed

5 files changed

+33
-7
lines changed

venona/Dockerfile

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,40 @@
11
FROM golang:1.14.4-alpine3.12 as build
22

3-
RUN apk -U add git make
3+
RUN apk -U add --no-cache git make ca-certificates && update-ca-certificates
44

5-
WORKDIR /venona
5+
ENV USER=venona
6+
ENV UID=10001
7+
8+
RUN adduser \
9+
--disabled-password \
10+
--gecos "" \
11+
--home "/nonexistent" \
12+
--shell "/sbin/nologin" \
13+
--no-create-home \
14+
--uid "${UID}" \
15+
"${USER}"
616

7-
COPY go.mod .
8-
RUN go mod download
17+
WORKDIR /venona
918

1019
COPY . .
20+
RUN go mod download -x
21+
RUN go mod verify
1122

23+
# compile
1224
RUN make build
1325

1426
FROM alpine:3.12
1527

16-
RUN apk update && apk add --no-cache ca-certificates && apk upgrade
28+
# copy ca-certs and user details
29+
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
30+
COPY --from=build /etc/passwd /etc/passwd
31+
COPY --from=build /etc/group /etc/group
1732

33+
# copy binary
1834
COPY --from=build /venona/venona /usr/local/bin/venona
1935

36+
USER venona:venona
37+
2038
ENTRYPOINT [ "venona" ]
2139

2240
CMD [ "start" ]

venona/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.18
1+
1.6.0

venonactl/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.18
1+
1.6.0

venonactl/pkg/templates/kubernetes/deployment.venona.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,8 @@ spec:
8888
name: {{ .AppName }}
8989
resources:
9090
{{ toYaml .Runner.Resources | indent 10 }}
91+
securityContext:
92+
runAsUser: 10001
93+
runAsGroup: 10001
94+
fsGroup: 10001
9195
restartPolicy: Always

venonactl/pkg/templates/kubernetes/templates.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)