From 07c88804c3d27061ce90c1ff6ec1e376ae8081cf Mon Sep 17 00:00:00 2001 From: Joe Lanford Date: Tue, 24 Aug 2021 21:39:34 -0400 Subject: [PATCH] update default scaffolded opm base image - Change default base image scaffolded during `opm index` and `opm alpha generate dockerfile` to `quay.io/operator-framework/opm:latest` - update opm-example.Dockerfile to reflect this change (and to focus on file-based configs rather than sqlite databases) Signed-off-by: Joe Lanford --- opm-example.Dockerfile | 23 +++++++++++-------- pkg/containertools/dockerfilegenerator.go | 2 +- .../dockerfilegenerator_test.go | 6 ++--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/opm-example.Dockerfile b/opm-example.Dockerfile index 85309a824..a59dfb1af 100644 --- a/opm-example.Dockerfile +++ b/opm-example.Dockerfile @@ -1,11 +1,14 @@ -FROM quay.io/operator-framework/upstream-opm-builder AS builder +# The base image is expected to contain +# /bin/opm (with a serve subcommand) and /bin/grpc_health_probe +FROM quay.io/operator-framework/opm:latest -FROM scratch -LABEL operators.operatorframework.io.index.database.v1=./index.db -COPY ["nsswitch.conf", "/etc/nsswitch.conf"] -COPY database ./ -COPY --from=builder /bin/opm /opm -COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe -EXPOSE 50051 -ENTRYPOINT ["/opm"] -CMD ["registry", "serve", "--database", "index.db"] +# Configure the entrypoint and command +ENTRYPOINT ["/bin/opm"] +CMD ["serve", "/configs"] + +# Copy declarative config root into image at /configs +ADD index /configs + +# Set DC-specific label for the location of the DC root directory +# in the image +LABEL operators.operatorframework.io.index.configs.v1=/configs diff --git a/pkg/containertools/dockerfilegenerator.go b/pkg/containertools/dockerfilegenerator.go index f580b3168..2ec06f41d 100644 --- a/pkg/containertools/dockerfilegenerator.go +++ b/pkg/containertools/dockerfilegenerator.go @@ -8,7 +8,7 @@ import ( ) const ( - DefaultBinarySourceImage = "quay.io/operator-framework/upstream-opm-builder" + DefaultBinarySourceImage = "quay.io/operator-framework/opm:latest" DefaultDbLocation = "/database/index.db" DbLocationLabel = "operators.operatorframework.io.index.database.v1" ConfigsLocationLabel = "operators.operatorframework.io.index.configs.v1" diff --git a/pkg/containertools/dockerfilegenerator_test.go b/pkg/containertools/dockerfilegenerator_test.go index 634397466..9952812bc 100644 --- a/pkg/containertools/dockerfilegenerator_test.go +++ b/pkg/containertools/dockerfilegenerator_test.go @@ -3,11 +3,11 @@ package containertools_test import ( "testing" - "github.com/operator-framework/operator-registry/pkg/containertools" - "github.com/golang/mock/gomock" "github.com/sirupsen/logrus" "github.com/stretchr/testify/require" + + "github.com/operator-framework/operator-registry/pkg/containertools" ) func TestGenerateDockerfile(t *testing.T) { @@ -39,7 +39,7 @@ func TestGenerateDockerfile_EmptyBaseImage(t *testing.T) { defer controller.Finish() databasePath := "database/index.db" - expectedDockerfile := `FROM quay.io/operator-framework/upstream-opm-builder + expectedDockerfile := `FROM quay.io/operator-framework/opm:latest LABEL operators.operatorframework.io.index.database.v1=/database/index.db ADD database/index.db /database/index.db EXPOSE 50051