-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deploy: generalize and fix building aisnode image
Signed-off-by: Janusz Marcinkiewicz <[email protected]>
- Loading branch information
Showing
2 changed files
with
58 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,54 @@ | ||
# | ||
# Usage: | ||
# $ env IMAGE_TAG="3.3" make all | ||
# $ env IMAGE_TAG="3.3" make all_debug | ||
# $ env REGISTRY_URL="docker.io" IMAGE_REPO="aistorage/aisnode" IMAGE_TAG="4.0" AIS_BACKEND_PROVIDERS="aws" make all | ||
# $ env REGISTRY_URL="docker.io" IMAGE_REPO="aistorage/aisnode" IMAGE_TAG="4.0" \ | ||
# AIS_BACKEND_PROVIDERS="aws" \ | ||
# make all | ||
# $ env REGISTRY_URL="docker.io" IMAGE_REPO="aistorage/aisnode" IMAGE_TAG="4.0-devel" \ | ||
# AIS_BACKEND_PROVIDERS="aws" BUILD_MODE="debug" BASE_IMAGE="debian:bookworm" \ | ||
# make all | ||
# | ||
|
||
DOCKER ?= docker | ||
DOCKER ?= docker | ||
REGISTRY_URL ?= docker.io | ||
IMAGE_REPO ?= aistorage/aisnode | ||
IMAGE_TAG ?= .must_set_in_environment | ||
IMAGE_REPO ?= aistorage/aisnode | ||
IMAGE_TAG ?= .must_set_in_environment | ||
|
||
# Image that is used to install necessary packages. | ||
INSTALLER_IMAGE ?= | ||
# Image that is used to build `aisnode` binary. | ||
BUILDER_IMAGE ?= | ||
# Image that is used in final stage. | ||
BASE_IMAGE ?= | ||
# By default we build image in "production" mode. It can be set to `debug` | ||
# to enable extra checks. | ||
BUILD_MODE ?= | ||
|
||
BUILD_ARGS = --build-arg "mode=$(BUILD_MODE)" --build-arg "providers=$(AIS_BACKEND_PROVIDERS)" | ||
ifneq ("$(INSTALLER_IMAGE)","") | ||
BUILD_ARGS += --build-arg "INSTALLER_IMAGE=$(INSTALLER_IMAGE)" | ||
endif | ||
ifneq ("$(BUILDER_IMAGE)","") | ||
BUILD_ARGS += --build-arg "BUILDER_IMAGE=$(BUILDER_IMAGE)" | ||
endif | ||
ifneq ("$(BASE_IMAGE)","") | ||
BUILD_ARGS += --build-arg "BASE_IMAGE=$(BASE_IMAGE)" | ||
endif | ||
|
||
|
||
.PHONY: all all_debug | ||
all: build push | ||
all_debug: build_debug push_debug | ||
|
||
.PHONY: build build_debug | ||
.PHONY: build | ||
build: | ||
$(DOCKER) build \ | ||
-f Dockerfile \ | ||
-t $(REGISTRY_URL)/$(IMAGE_REPO):$(IMAGE_TAG) \ | ||
--build-arg providers=$(AIS_BACKEND_PROVIDERS) \ | ||
"../../../../." | ||
|
||
build_debug: | ||
$(DOCKER) build \ | ||
-f Dockerfile \ | ||
-t $(REGISTRY_URL)/$(IMAGE_REPO):$(IMAGE_TAG)-debug \ | ||
--build-arg mode="debug" --build-arg providers=$(AIS_BACKEND_PROVIDERS) \ | ||
$(BUILD_ARGS) \ | ||
"../../../../." | ||
|
||
.PHONY: push push_debug | ||
.PHONY: push | ||
push: | ||
docker push $(REGISTRY_URL)/$(IMAGE_REPO):$(IMAGE_TAG) | ||
|
||
push_debug: | ||
docker push $(REGISTRY_URL)/$(IMAGE_REPO):$(IMAGE_TAG)-debug | ||
|
||
|