Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use common base image #386

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
- name: Checkout the code
uses: actions/checkout@v3
- name: Build Docker Images
run: docker build . -t csm-operator:latest
run: DEFAULT_IMG=csm-operator:latest make -o gen-semver docker-build
- name: Scan controller Image
uses: Azure/container-scan@v0
env:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG BASEIMAGE

# Build the manager binary
FROM golang:1.21 as builder

Expand All @@ -35,9 +37,7 @@ COPY tests/ tests/
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go

# Tag corresponding to digest sha256:630cf7bdef807f048cadfe7180d6c27eb3aaa99323ffc3628811da230ed3322a for ubi9 micro is 9.2-13
FROM registry.access.redhat.com/ubi9/ubi-micro@sha256:630cf7bdef807f048cadfe7180d6c27eb3aaa99323ffc3628811da230ed3322a

FROM $BASEIMAGE as final
ENV USER_UID=1001 \
USER_NAME=dell-csm-operator
WORKDIR /
Expand Down
20 changes: 14 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ build: gen-semver fmt vet ## Build manager binary.
run: generate gen-semver fmt vet static-manifests ## Run a controller from your host.
go run ./main.go

podman-build: gen-semver ## Build podman image with the manager.
podman build . -t ${DEFAULT_IMG}
podman-build: gen-semver download-csm-common ## Build podman image with the manager.
$(eval include csm-common.mk)
podman build . -t ${DEFAULT_IMG} --build-arg BASEIMAGE=$(DEFAULT_BASEIMAGE)

docker-build: gen-semver ## Build docker image with the manager.
docker build . -t ${DEFAULT_IMG}
docker-build: gen-semver download-csm-common ## Build docker image with the manager.
$(eval include csm-common.mk)
docker build . -t ${DEFAULT_IMG} --build-arg BASEIMAGE=$(DEFAULT_BASEIMAGE)

docker-push: docker-build ## Builds, tags and pushes docker image with the manager.
docker tag ${DEFAULT_IMG} ${IMG}
Expand Down Expand Up @@ -167,8 +169,9 @@ bundle: static-manifests gen-semver kustomize ## Generate bundle manifests and m
operator-sdk bundle validate ./bundle

.PHONY: bundle-build
bundle-build: gen-semver ## Build the bundle image.
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
bundle-build: gen-semver download-csm-common ## Build the bundle image.
$(eval include csm-common.mk)
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) --build-arg BASEIMAGE=$(DEFAULT_BASEIMAGE) .

.PHONY: bundle-push
bundle-push: gen-semver ## Push the bundle image.
Expand Down Expand Up @@ -216,3 +219,8 @@ catalog-push: gen-semver ## Push a catalog image.
.PHONY: lint
lint: build
golangci-lint run --fix

# Download common CSM configuration file used for builds
.PHONY: download-csm-common
download-csm-common:
curl -O -L https://raw.githubusercontent.com/dell/csm/main/config/csm-common.mk
3 changes: 2 additions & 1 deletion bundle.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM registry.access.redhat.com/ubi9/ubi-micro@sha256:630cf7bdef807f048cadfe7180d6c27eb3aaa99323ffc3628811da230ed3322a
ARG BASEIMAGE

FROM $BASEIMAGE as final
# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
Expand Down