Created
June 15, 2018 04:11
-
-
Save nmarley/89c1ed56ee57987ca64ababcb1ef0fc6 to your computer and use it in GitHub Desktop.
modern Makefile for CI/CD, etc, w/AWS ECR. "WA" is 2-letter country-code for Wakanda
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
# System setup | |
SHELL = bash | |
AWS_ACCOUNT_ID ?= 100000000001 | |
AWS_REGION ?= wa-north-7 | |
AWS_ACCESS_KEY_ID ?= AKIABLAHBLAHBLAHBLAH | |
AWS_SECRET_ACCESS_KEY ?= Z9xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+ | |
DOCKER_REGISTRY ?= $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com | |
test: ## Run a basic test suite, currently just the PEP8 style check | |
pycodestyle *py --show-source | |
ecr_login: ## Login to the ECR using credentials | |
@eval $$(AWS_ACCESS_KEY_ID=$(AWS_ACCESS_KEY_ID) AWS_SECRET_ACCESS_KEY=$(AWS_SECRET_ACCESS_KEY) aws --region $(AWS_REGION) ecr get-login --no-include-email) | |
python_install: ## Set up Python virtualenv and install dependencies | |
virtualenv -p $$(which python3) ./venv && ./venv/bin/pip install -r requirements.txt | |
help: ## Show This Help | |
@for line in $$(cat Makefile | grep "##" | grep -v "grep" | sed "s/:.*##/:/g" | sed "s/\ /!/g"); do verb=$$(echo $$line | cut -d ":" -f 1); desc=$$(echo $$line | cut -d ":" -f 2 | sed "s/!/\ /g"); printf "%-30s--%s\n" "$$verb" "$$desc"; done | |
travis_setup: ## Setup the travis environment | |
@echo "Unshallowing repo" | |
@git fetch --unshallow | |
@git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" | |
@git fetch origin | |
@sudo pip install awscli |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment