-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathContainerfile.catalog
More file actions
54 lines (46 loc) · 2.51 KB
/
Containerfile.catalog
File metadata and controls
54 lines (46 loc) · 2.51 KB
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
# Containerfile for building OLMv1 File-Based Catalog image with registry-server
#
# This Containerfile creates an executable catalog image that runs the operator-framework
# registry-server to serve operator metadata via gRPC. It uses a multi-stage build pattern
# to pre-generate the catalog cache for optimized startup performance.
#
# Build command:
# podman build -f Containerfile.catalog -t ghcr.io/stacklok/toolhive-operator-metadata/catalog:v0.6.11 .
# or: make catalog-build
#
# Validation command (after build):
# opm validate ghcr.io/stacklok/toolhive-operator-metadata/catalog:v0.6.11
#
# Local testing:
# podman run -d -p 50051:50051 --name catalog-test ghcr.io/stacklok/toolhive-operator-metadata/catalog:v0.6.11
# grpcurl -plaintext localhost:50051 api.Registry/ListPackages
# ============================================================================
# Builder Stage: Pre-populate catalog cache
# ============================================================================
FROM quay.io/operator-framework/opm:latest AS builder
# Copy FBC metadata to /configs
# This directory contains all FBC schema files (olm.package, olm.channel, olm.bundle)
ADD catalog /configs
# Pre-generate catalog cache for fast runtime startup
# The --cache-only flag generates cache without starting the server
RUN ["/bin/opm", "serve", "/configs", "--cache-dir=/tmp/cache", "--cache-only"]
# ============================================================================
# Runtime Stage: Serve catalog via registry-server
# ============================================================================
FROM quay.io/operator-framework/opm:latest
# Configure registry-server entrypoint and command
ENTRYPOINT ["/bin/opm"]
CMD ["serve", "/configs", "--cache-dir=/tmp/cache"]
# Copy catalog metadata and pre-built cache from builder stage
COPY --from=builder /configs /configs
COPY --from=builder /tmp/cache /tmp/cache
# Required label for OLM to locate the catalog metadata
# This tells OLM where to find the FBC schemas within the image
LABEL operators.operatorframework.io.index.configs.v1=/configs
# Optional metadata labels for better image documentation
LABEL org.opencontainers.image.title="ToolHive Operator Catalog"
LABEL org.opencontainers.image.description="File-Based Catalog for ToolHive Operator (OLMv1)"
LABEL org.opencontainers.image.vendor="Stacklok"
LABEL org.opencontainers.image.source="https://github.com/stacklok/toolhive-operator-metadata"
LABEL org.opencontainers.image.version="v0.6.11"
LABEL org.opencontainers.image.licenses="Apache-2.0"