From 154f4448e96071122809e53197480cfacb0d17c8 Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Mon, 15 Jun 2020 19:03:01 +0100 Subject: [PATCH 1/5] Changed owner of file to 8888 --- executor/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executor/Dockerfile b/executor/Dockerfile index 32a72a4044..d242f00243 100644 --- a/executor/Dockerfile +++ b/executor/Dockerfile @@ -27,6 +27,6 @@ WORKDIR / COPY --from=builder /workspace/executor . COPY licenses/license.txt licenses/license.txt # Copy openapi spec and swagger UI files -COPY api/rest/openapi/ /openapi/ +COPY --chown=8888 api/rest/openapi/ /openapi/ ENTRYPOINT ["/executor"] From 9fcb542744d73ab4845af5b8d7d05428009e9a3d Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Tue, 16 Jun 2020 06:26:27 +0100 Subject: [PATCH 2/5] Changed to ensure extended permissions on file instead of chown --- executor/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/executor/Dockerfile b/executor/Dockerfile index d242f00243..610fc10068 100644 --- a/executor/Dockerfile +++ b/executor/Dockerfile @@ -20,6 +20,10 @@ COPY k8s/ k8s/ # Build RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o executor main.go +# Change the permissions +COPY api/rest/openapi/ /openapi/ +RUN chmod -R 777 /openapi/ + # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details FROM gcr.io/distroless/static:latest @@ -27,6 +31,6 @@ WORKDIR / COPY --from=builder /workspace/executor . COPY licenses/license.txt licenses/license.txt # Copy openapi spec and swagger UI files -COPY --chown=8888 api/rest/openapi/ /openapi/ +COPY --from=builder /openapi/ /openapi/ ENTRYPOINT ["/executor"] From 03c4a91b34f2c0291a719423f688376300115b9f Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Tue, 16 Jun 2020 06:36:45 +0100 Subject: [PATCH 3/5] Changed chmod to 660 as only read-write permissions required for user and group --- executor/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executor/Dockerfile b/executor/Dockerfile index 610fc10068..397818d19a 100644 --- a/executor/Dockerfile +++ b/executor/Dockerfile @@ -22,7 +22,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o executor # Change the permissions COPY api/rest/openapi/ /openapi/ -RUN chmod -R 777 /openapi/ +RUN chmod -R 660 /openapi/ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details From 1c236d9efa05825862abd78ed4baa28430ff5ad3 Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Tue, 16 Jun 2020 11:19:28 +0100 Subject: [PATCH 4/5] Added extra functionality to build docker redhat image --- executor/Dockerfile | 2 +- executor/Dockerfile.redhat | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/executor/Dockerfile b/executor/Dockerfile index 397818d19a..065b19727b 100644 --- a/executor/Dockerfile +++ b/executor/Dockerfile @@ -20,7 +20,7 @@ COPY k8s/ k8s/ # Build RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o executor main.go -# Change the permissions +# Copy OpenAPI folder and change the permissions COPY api/rest/openapi/ /openapi/ RUN chmod -R 660 /openapi/ diff --git a/executor/Dockerfile.redhat b/executor/Dockerfile.redhat index 8d893314bf..d505fd4029 100644 --- a/executor/Dockerfile.redhat +++ b/executor/Dockerfile.redhat @@ -20,6 +20,10 @@ COPY k8s/ k8s/ # Build RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o executor main.go +# Copy OpenAPI folder and change the permissions +COPY api/rest/openapi/ /openapi/ +RUN chmod -R 660 /openapi/ + FROM registry.access.redhat.com/ubi8/ubi-minimal LABEL name="Seldon Executor" \ vendor="Seldon Technologies" \ @@ -31,4 +35,8 @@ LABEL name="Seldon Executor" \ WORKDIR / COPY --from=builder /workspace/executor . COPY licenses/license.txt licenses/license.txt + +# Copy openapi spec and swagger UI files +COPY --from=builder /openapi/ /openapi/ + ENTRYPOINT ["/executor"] From c59eae50a84d944c007319d44cf955fca5a0f636 Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Tue, 16 Jun 2020 11:20:42 +0100 Subject: [PATCH 5/5] Fix typo on makefile --- executor/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executor/Makefile b/executor/Makefile index d3298ded84..8749764708 100644 --- a/executor/Makefile +++ b/executor/Makefile @@ -70,7 +70,7 @@ docker-build: test copy_openapi_resources docker build -f Dockerfile -t ${IMG} . # Build the docker image for Redhat -docker-build-redhat: test copy-openapi-resources +docker-build-redhat: test copy_openapi_resources docker build . -f Dockerfile.redhat -t ${IMG_REDHAT} # Push the docker image