Skip to content

Commit

Permalink
Create separate images for placement and sentry (dapr#1405)
Browse files Browse the repository at this point in the history
  • Loading branch information
pruthvidhodda authored Apr 14, 2020
1 parent d38afff commit fad6564
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docker/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ DOCKERFILE_DIR?=./docker

DAPR_SYSTEM_IMAGE_NAME=$(RELEASE_NAME)
DAPR_RUNTIME_IMAGE_NAME=daprd
DAPR_PLACEMENT_IMAGE_NAME=placement
DAPR_SENTRY_IMAGE_NAME=sentry


ifeq ($(origin DEBUG), undefined)
DOCKERFILE:=Dockerfile
Expand All @@ -29,10 +32,14 @@ DOCKERMUTI_ARCH=linux/amd64,linux/arm/v7
LINUX_BINS_OUT_DIR=$(OUT_DIR)/linux_$(GOARCH)
DOCKER_IMAGE_TAG=$(DAPR_REGISTRY)/$(DAPR_SYSTEM_IMAGE_NAME):$(DAPR_TAG)
DAPR_RUNTIME_DOCKER_IMAGE_TAG=$(DAPR_REGISTRY)/$(DAPR_RUNTIME_IMAGE_NAME):$(DAPR_TAG)
DAPR_PLACEMENT_DOCKER_IMAGE_TAG=$(DAPR_REGISTRY)/$(DAPR_PLACEMENT_IMAGE_NAME):$(DAPR_TAG)
DAPR_SENTRY_DOCKER_IMAGE_TAG=$(DAPR_REGISTRY)/$(DAPR_SENTRY_IMAGE_NAME):$(DAPR_TAG)

ifeq ($(LATEST_RELEASE),true)
DOCKER_IMAGE_LATEST_TAG=$(DAPR_REGISTRY)/$(DAPR_SYSTEM_IMAGE_NAME):$(LATEST_TAG)
DAPR_RUNTIME_DOCKER_IMAGE_LATEST_TAG=$(DAPR_REGISTRY)/$(DAPR_RUNTIME_IMAGE_NAME):$(LATEST_TAG)
DAPR_PLACEMENT_DOCKER_IMAGE_LATEST_TAG=$(DAPR_REGISTRY)/$(DAPR_PLACEMENT_IMAGE_NAME):$(LATEST_TAG)
DAPR_SENTRY_DOCKER_IMAGE_LATEST_TAG=$(DAPR_REGISTRY)/$(DAPR_SENTRY_IMAGE_NAME):$(LATEST_TAG)
endif

# To use buildx: https://github.com/docker/buildx#docker-ce
Expand All @@ -52,12 +59,16 @@ docker-build: check-docker-env
$(info Building $(DOCKER_IMAGE_TAG) docker image ...)
$(DOCKER) build --build-arg TARGETPLATFORM=linux/amd64 --build-arg PKG_FILES=* -f $(DOCKERFILE_DIR)/$(DOCKERFILE) $(OUT_DIR)/. -t $(DOCKER_IMAGE_TAG)
$(DOCKER) build --build-arg TARGETPLATFORM=linux/amd64 --build-arg PKG_FILES=daprd -f $(DOCKERFILE_DIR)/$(DOCKERFILE) $(OUT_DIR)/. -t $(DAPR_RUNTIME_DOCKER_IMAGE_TAG)
$(DOCKER) build --build-arg TARGETPLATFORM=linux/amd64 --build-arg PKG_FILES=placement -f $(DOCKERFILE_DIR)/$(DOCKERFILE) $(OUT_DIR)/. -t $(DAPR_PLACEMENT_DOCKER_IMAGE_TAG)
$(DOCKER) build --build-arg TARGETPLATFORM=linux/amd64 --build-arg PKG_FILES=sentry -f $(DOCKERFILE_DIR)/$(DOCKERFILE) $(OUT_DIR)/. -t $(DAPR_SENTRY_DOCKER_IMAGE_TAG)

# push docker image to the registry
docker-push: docker-build
$(info Pushing $(DOCKER_IMAGE_TAG) docker image ...)
$(DOCKER) push $(DOCKER_IMAGE_TAG)
$(DOCKER) push $(DAPR_RUNTIME_DOCKER_IMAGE_TAG)
$(DOCKER) push $(DAPR_PLACEMENT_DOCKER_IMAGE_TAG)
$(DOCKER) push $(DAPR_SENTRY_DOCKER_IMAGE_TAG)

# publish muti-arch docker image to the registry
docker-publish: check-docker-env
Expand All @@ -66,10 +77,14 @@ docker-publish: check-docker-env
$(info Pushing $(DOCKER_IMAGE_TAG) docker image ...)
$(DOCKER) buildx build --build-arg PKG_FILES=* --platform $(DOCKERMUTI_ARCH) -t $(DOCKER_IMAGE_TAG) $(OUT_DIR) -f $(DOCKERFILE_DIR)/$(DOCKERFILE) --push
$(DOCKER) buildx build --build-arg PKG_FILES=daprd --platform $(DOCKERMUTI_ARCH) -t $(DAPR_RUNTIME_DOCKER_IMAGE_TAG) $(OUT_DIR) -f $(DOCKERFILE_DIR)/$(DOCKERFILE) --push
$(DOCKER) buildx build --build-arg PKG_FILES=placement --platform $(DOCKERMUTI_ARCH) -t $(DAPR_PLACEMENT_DOCKER_IMAGE_TAG) $(OUT_DIR) -f $(DOCKERFILE_DIR)/$(DOCKERFILE) --push
$(DOCKER) buildx build --build-arg PKG_FILES=sentry --platform $(DOCKERMUTI_ARCH) -t $(DAPR_SENTRY_DOCKER_IMAGE_TAG) $(OUT_DIR) -f $(DOCKERFILE_DIR)/$(DOCKERFILE) --push
ifeq ($(LATEST_RELEASE),true)
$(info Pushing $(DOCKER_IMAGE_LATEST_TAG) docker image ...)
$(DOCKER) buildx build --build-arg PKG_FILES=* --platform $(DOCKERMUTI_ARCH) -t $(DOCKER_IMAGE_LATEST_TAG) $(OUT_DIR) -f $(DOCKERFILE_DIR)/$(DOCKERFILE) --push
$(DOCKER) buildx build --build-arg PKG_FILES=daprd --platform $(DOCKERMUTI_ARCH) -t $(DAPR_RUNTIME_DOCKER_IMAGE_LATEST_TAG) $(OUT_DIR) -f $(DOCKERFILE_DIR)/$(DOCKERFILE) --push
$(DOCKER) buildx build --build-arg PKG_FILES=placement --platform $(DOCKERMUTI_ARCH) -t $(DAPR_PLACEMENT_DOCKER_IMAGE_LATEST_TAG) $(OUT_DIR) -f $(DOCKERFILE_DIR)/$(DOCKERFILE) --push
$(DOCKER) buildx build --build-arg PKG_FILES=sentry --platform $(DOCKERMUTI_ARCH) -t $(DAPR_SENTRY_DOCKER_IMAGE_LATEST_TAG) $(OUT_DIR) -f $(DOCKERFILE_DIR)/$(DOCKERFILE) --push
endif

################################################################################
Expand Down

0 comments on commit fad6564

Please sign in to comment.