Skip to content

Commit 8270ee9

Browse files
committed
Makefile: Improve containerized target
As of now for this target we are building image first and then copy the binaries out from container to host. This PR uses same base image which openshift-ci using and mount the current working directory and execute cross builds so that building image is not required and also binary directly available to host.
1 parent 14dfefa commit 8270ee9

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,9 @@ $(HOST_BUILD_DIR)/crc-embedder: $(SOURCES)
113113
cross: $(BUILD_DIR)/macos-arm64/crc $(BUILD_DIR)/macos-amd64/crc $(BUILD_DIR)/linux-amd64/crc $(BUILD_DIR)/linux-arm64/crc $(BUILD_DIR)/windows-amd64/crc.exe
114114

115115
.PHONY: containerized ## Cross compile from container
116+
containerized: image := $(shell grep -m 1 '^FROM' images/openshift-ci/Dockerfile | awk '{print $$2}')
116117
containerized: clean
117-
${CONTAINER_RUNTIME} build -t crc-build -f images/build .
118-
${CONTAINER_RUNTIME} run --name crc-cross crc-build make cross
119-
${CONTAINER_RUNTIME} cp crc-cross:/opt/app-root/src/out ./
120-
${CONTAINER_RUNTIME} rm crc-cross
121-
${CONTAINER_RUNTIME} rmi crc-build
118+
${CONTAINER_RUNTIME} run --rm -v ${PWD}:/data${SELINUX_VOLUME_LABEL} ${image} /bin/bash -c "cd /data && make cross"
122119

123120
.PHONY: generate_mocks
124121
generate_mocks: $(TOOLS_BINDIR)/mockery

0 commit comments

Comments
 (0)