Skip to content

Commit

Permalink
caa: Fix missing defaults and yq in image build
Browse files Browse the repository at this point in the history
After the changes in confidential-containers#1448 the root Makefile now references Makefile.defaults, this file and the yq binary need to be included for the build

Signed-off-by: James Tumber <[email protected]>
  • Loading branch information
tumberino authored and lysliu committed Nov 9, 2023
1 parent 9fe498f commit 57508fb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1.5-labs
ARG BUILD_TYPE=dev
ARG BUILDER_BASE=quay.io/confidential-containers/golang-fedora:1.20.8-36
ARG BASE=registry.fedoraproject.org/fedora:38
Expand All @@ -12,10 +13,16 @@ ARG RELEASE_BUILD
ARG COMMIT
ARG VERSION
ARG TARGETARCH
ARG YQ_VERSION
ARG YQ_CHECKSUM

ADD --checksum=${YQ_CHECKSUM} https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 /usr/local/bin/yq
RUN chmod a+x /usr/local/bin/yq

WORKDIR /work
COPY go.mod go.sum ./
RUN go mod download
COPY entrypoint.sh Makefile ./
COPY entrypoint.sh Makefile Makefile.defaults versions.yaml ./
COPY cmd ./cmd
COPY pkg ./pkg
COPY proto ./proto
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ clean: ## Remove binaries.

.PHONY: image
image: .git-commit ## Build and push docker image to $registry
COMMIT=$(COMMIT) VERSION=$(VERSION) hack/build.sh -i
COMMIT=$(COMMIT) VERSION=$(VERSION) YQ_VERSION=$(YQ_VERSION) YQ_CHECKSUM=$(YQ_CHECKSUM) hack/build.sh -i

.PHONY: image-with-arch
image-with-arch: .git-commit ## Build the per arch image
COMMIT=$(COMMIT) VERSION=$(VERSION) hack/build.sh -a
COMMIT=$(COMMIT) VERSION=$(VERSION) YQ_VERSION=$(YQ_VERSION) YQ_CHECKSUM=$(YQ_CHECKSUM) hack/build.sh -a

##@ Deployment

Expand Down
8 changes: 6 additions & 2 deletions hack/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ function build_caa_payload_image() {
--build-arg BUILD_TYPE="${build_type}" \
--build-arg VERSION="${version}" \
--build-arg COMMIT="${commit}" \
--build-arg YQ_VERSION="${YQ_VERSION}" \
--build-arg YQ_CHECKSUM="${YQ_CHECKSUM}" \
-f Dockerfile \
${tag_string} \
--push \
Expand All @@ -76,7 +78,7 @@ function get_arch_specific_tag_string() {
echo "$tag_string"
}

# accept one arch as --platform
# accept one arch as --platform
function build_caa_payload_arch_specific() {
pushd "${script_dir}/.."

Expand All @@ -100,6 +102,8 @@ function build_caa_payload_arch_specific() {
--build-arg BUILD_TYPE="${build_type}" \
--build-arg VERSION="${version}" \
--build-arg COMMIT="${commit}" \
--build-arg YQ_VERSION="${YQ_VERSION}" \
--build-arg YQ_CHECKSUM="${YQ_CHECKSUM}" \
-f Dockerfile \
${tag_string} \
--push \
Expand All @@ -119,4 +123,4 @@ while getopts ":ai" option; do
\?) # Invalid option
echo "Error: Invalid option"
esac
done
done

0 comments on commit 57508fb

Please sign in to comment.