Skip to content

Commit

Permalink
feature(devops): automated deploy for dev environment
Browse files Browse the repository at this point in the history
  • Loading branch information
fagomezra committed Sep 25, 2023
1 parent 4f9368d commit 9333309
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions hapi/makefile
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)

0 comments on commit 9333309

Please sign in to comment.