1# Copyright 2021 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4# 5# Builds docker images for the crosvm builders. 6# Run the `upload` target to upload the images to the container registry 7# (provided you are authorized to upload them). 8# 9# Images are always built with docker (since buildkit is a lot faster than 10# podman/buildah). But we do automatically pull images into podman if podman 11# is installed. 12 13export DOCKER_BUILDKIT=1 14 15TAG_BASE=gcr.io/crosvm-packages 16TAG_VERSION=$(shell cat image_tag) 17 18DOCKER ?= docker 19 20all: crosvm_builder crosvm_aarch64_builder 21 22upload: all 23 $(DOCKER) push $(TAG_BASE)/crosvm_base:$(TAG_VERSION) 24 $(DOCKER) push $(TAG_BASE)/crosvm_builder:$(TAG_VERSION) 25 $(DOCKER) push $(TAG_BASE)/crosvm_aarch64_builder:$(TAG_VERSION) 26 $(DOCKER) push $(TAG_BASE)/crosvm_test_vm_amd64:$(TAG_VERSION) 27 $(DOCKER) push $(TAG_BASE)/crosvm_test_vm_arm64:$(TAG_VERSION) 28 29crosvm_base: 30 cd $@ && $(DOCKER) build -t $(TAG_BASE)/$@:$(TAG_VERSION) . 31 32crosvm_builder: crosvm_base crosvm_test_vm_amd64 33 cd $@ && $(DOCKER) build \ 34 -t $(TAG_BASE)/$@:$(TAG_VERSION) \ 35 --build-arg TAG=$(TAG_VERSION) \ 36 . 37ifneq (, $(shell command -v podman)) 38 podman pull docker-daemon:$(TAG_BASE)/$@:$(TAG_VERSION) 39endif 40 41crosvm_aarch64_builder: crosvm_base crosvm_test_vm_arm64 42 cd $@ && $(DOCKER) build \ 43 -t $(TAG_BASE)/$@:$(TAG_VERSION) \ 44 --build-arg TAG=$(TAG_VERSION) \ 45 . 46ifneq (, $(shell command -v podman)) 47 podman pull docker-daemon:$(TAG_BASE)/$@:$(TAG_VERSION) 48endif 49 50crosvm_test_vm_amd64: 51 cd crosvm_test_vm && \ 52 $(DOCKER) build -t $(TAG_BASE)/$@:$(TAG_VERSION) --build-arg VM_ARCH=amd64 . 53 54crosvm_test_vm_arm64: 55 cd crosvm_test_vm && \ 56 $(DOCKER) build -t $(TAG_BASE)/$@:$(TAG_VERSION) --build-arg VM_ARCH=arm64 . 57 58.PHONY: all crosvm_base crosvm_builder crosvm_aarch64_builder 59