Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
sf-api/Makefile
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
48 lines (36 sloc)
1.43 KB
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
.PHONY: help | |
APP_NAME ?= $(shell grep 'app:' mix.exs | sed -e 's/\[//g' -e 's/ //g' -e 's/app://' -e 's/[:,]//g') | |
APP_VSN ?= $(shell grep 'version:' mix.exs | cut -d '"' -f2) | |
BUILD ?= $(shell git rev-parse --short HEAD) | |
help: | |
@echo "$(APP_NAME):$(APP_VSN)-$(BUILD)" | |
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | |
get-login: | |
$(shell aws ecr get-login --region us-east-2 --no-include-email) | |
get-login-prod: | |
$(shell aws ecr get-login --region us-east-1 --no-include-email) | |
build: | |
skaffold build --file-output=tags.json | |
build-prod: | |
skaffold build -f skaffold_prod.yaml --file-output=prod-tags.json | |
deploy: | |
skaffold deploy --build-artifacts=tags.json | |
deploy-prod: | |
skaffold deploy -f skaffold_prod.yaml --build-artifacts=prod-tags.json | |
## Build the Docker image | |
docker-build: | |
docker build --build-arg APP_NAME=$(APP_NAME) \ | |
--build-arg APP_VSN=$(APP_VSN) \ | |
-t $(APP_NAME):$(APP_VSN)-$(BUILD) \ | |
-t $(APP_NAME):latest . | |
## Run the app in Docker | |
docker-run: | |
docker run --env-file config/docker.env \ | |
--expose 4001 -p 4000:4001 \ | |
--rm -it $(APP_NAME):latest | |
docker-shell: | |
docker run --env-file config/docker.env \ | |
--expose 4001 -p 4000:4001 \ | |
--rm -it $(APP_NAME):latest bash | |
kube-redeploy: | |
kubectl patch deployment sf-api -p "{\"spec\": {\"template\": {\"metadata\": { \"labels\": { \"redeploy\": \"$(date +%s)\"}}}}}" |