-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(devops): automated deploy for dev environment
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
include ../utils/meta.mk ../utils/help.mk | ||
|
||
LATEST_TAG ?= latest | ||
|
||
install: ##@local Install all dependencies | ||
install: | ||
@npm install | ||
|
||
clean-install: ##@local Reinstalls all dependencies | ||
clean-install: | ||
@rm -Rf node_modules | ||
@npm install | ||
|
||
run: ##@local Run the project locally (without docker) | ||
run: node_modules | ||
@$(SHELL_EXPORT) npm run dev | ||
|
||
build-docker: ##@devops Build the docker image | ||
build-docker: ./Dockerfile | ||
@docker pull $(DOCKER_REGISTRY)/$(IMAGE_NAME_HAPI):$(VERSION) || true | ||
@docker build \ | ||
--target release \ | ||
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME_HAPI):$(VERSION) \ | ||
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME_HAPI):$(LATEST_TAG) \ | ||
. | ||
|
||
pull-image: ##@devops Pull the latest image from registry for caching | ||
pull-image: | ||
@docker pull $(DOCKER_REGISTRY)/$(IMAGE_NAME_HAPI):$(LATEST_TAG) || true | ||
|
||
build-docker-cached: ##@devops Build the docker image using cached layers | ||
build-docker-cached: ./Dockerfile | ||
@docker build \ | ||
--target prod-stage \ | ||
--cache-from $(DOCKER_REGISTRY)/$(IMAGE_NAME_HAPI):$(LATEST_TAG) \ | ||
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME_HAPI):$(VERSION) \ | ||
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME_HAPI):$(LATEST_TAG) \ | ||
. | ||
|
||
push-image: ##@devops Push the freshly built image and tag with release or latest tag | ||
push-image: | ||
@docker push $(DOCKER_REGISTRY)/$(IMAGE_NAME_HAPI):$(VERSION) |