Skip to content

Commit

Permalink
Use non root user in operator.Dockerfile (#759)
Browse files Browse the repository at this point in the history
* Use non-root user in operator image

* run make manager first
  • Loading branch information
jiangpengcheng authored May 23, 2024
1 parent a13cddc commit 7e58e52
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .ci/tests/integration-oauth2/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ setup:
- name: install function-mesh operator
command: |
make generate
make manager
make helm-crds
image="function-mesh-operator:latest"
IMG=${image} make docker-build-skip-test
image="function-mesh:latest"
docker build --platform linux/amd64 -f operator.Dockerfile -t $image .
kind load docker-image ${image}
helm install ${FUNCTION_MESH_RELEASE_NAME} -n ${FUNCTION_MESH_NAMESPACE} --set operatorImage=${image} --create-namespace charts/function-mesh-operator
wait:
Expand Down
6 changes: 3 additions & 3 deletions .ci/tests/integration-oauth2/e2e_with_downloader.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ setup:
- name: install function-mesh operator
command: |
make generate
make manager
make helm-crds
image="function-mesh-operator:latest"
IMG=${image} make docker-build-skip-test
image="function-mesh:latest"
docker build --platform linux/amd64 -f operator.Dockerfile -t $image .
kind load docker-image ${image}
helm install ${FUNCTION_MESH_RELEASE_NAME} -n ${FUNCTION_MESH_NAMESPACE} --set operatorImage=${image} --set controllerManager.enableInitContainers=true --create-namespace charts/function-mesh-operator
wait:
Expand Down
13 changes: 11 additions & 2 deletions operator.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
FROM alpine:3.20

RUN apk add tzdata --no-cache
RUN apk upgrade --no-cache
ENV GID=10001
ENV UID=10000
ENV USER=pulsar

RUN apk upgrade --no-cache \
&& apk add tzdata --no-cache \
&& addgroup -g $GID pulsar \
&& adduser -u $UID -G pulsar -D -g '' $USER

ADD bin/function-mesh-controller-manager /manager

USER $USER

0 comments on commit 7e58e52

Please sign in to comment.