-
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.
!#5 Fix: settings script of makefile
- Loading branch information
Showing
16 changed files
with
388 additions
and
99 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 |
---|---|---|
@@ -1,66 +1,103 @@ | ||
# Makefile for slides-docker4devs. | ||
.PHONY: build deploy lint test functions help | ||
.DEFAULT_GOAL := help | ||
|
||
DOCKER_NETWORK = slides-docker4devs_network | ||
PROYECT_NAME = slides-docker4devs | ||
|
||
# Configuration. | ||
SHELL = /bin/bash | ||
ROOT_DIR = $(shell pwd) | ||
BIN_DIR = $(ROOT_DIR)/bin | ||
DATA_DIR = $(ROOT_DIR)/var | ||
MESSAGE="༼ つ ◕_◕ ༽つ" | ||
MESSAGE_HAPPY="${MESSAGE} Happy Coding" | ||
SCRIPT_DIR = $(ROOT_DIR)/script | ||
|
||
WGET = wget | ||
|
||
# Bin scripts | ||
BUILD = $(shell) $(SCRIPT_DIR)/build.sh | ||
CLEAN = $(shell) $(SCRIPT_DIR)/clean.sh | ||
GVM = $(shell) $(SCRIPT_DIR)/gvm.sh | ||
GRIP = $(shell) $(SCRIPT_DIR)/grip.sh | ||
INSTALL = $(shell) $(SCRIPT_DIR)/install.sh | ||
DOCUMENTATION = $(shell) $(SCRIPT_DIR)/documentation.sh | ||
DOWN = $(shell) $(SCRIPT_DIR)/down.sh | ||
PYENV = $(shell) $(SCRIPT_DIR)/pyenv.sh | ||
INSTALL = $(shell) $(SCRIPT_DIR)/install.sh | ||
LINTCODE = $(shell) $(SCRIPT_DIR)/lintcode.sh | ||
LIST = $(shell) $(SCRIPT_DIR)/list.sh | ||
LINT = $(shell) $(SCRIPT_DIR)/lint.sh | ||
TEST = $(shell) $(SCRIPT_DIR)/test.sh | ||
WATCH = $(shell) $(SCRIPT_DIR)/watch.sh | ||
GENERATE = $(shell) $(SCRIPT_DIR)/generate.sh | ||
|
||
clean: | ||
$(CLEAN) | ||
STOP = $(shell) $(SCRIPT_DIR)/stop.sh | ||
SETUP = $(shell) $(SCRIPT_DIR)/setup.sh | ||
UP = $(shell) $(SCRIPT_DIR)/up.sh | ||
|
||
build: ## Build docker container by env | ||
make clean | ||
@echo $(MESSAGE) "Building environment: ${env}" | ||
$(BUILD) "${env}" && echo $(MESSAGE_HAPPY) | ||
|
||
distclean: clean | ||
rm -rf $(ROOT_DIR)/lib | ||
rm -rf $(ROOT_DIR)/*.egg-info | ||
rm -rf $(ROOT_DIR)/demo/*.egg-info | ||
clean: ## clean Files compiled | ||
$(CLEAN) | ||
|
||
|
||
environment: | ||
environment: ## Make environment for developer | ||
$(PYENV) | ||
$(GVM) | ||
$(INSTALL) | ||
|
||
|
||
grip: | ||
$(GRIP) | ||
documentation: ## Make Documentation | ||
make clean | ||
$(DOCUMENTATION) | ||
|
||
down: ## remove containers docker by env | ||
make clean | ||
@echo $(MESSAGE) "Down Services Environment: ${env}" | ||
$(DOWN) "${env}" && echo $(MESSAGE_HAPPY) | ||
|
||
env: ## Show envs available | ||
@echo $(MESSAGE) "Environments:" | ||
@echo "dev" | ||
@echo "test" | ||
@echo "stage" | ||
|
||
install: | ||
$(INSTALL) | ||
install: ## Install with var env Dependences | ||
make clean | ||
@echo $(MESSAGE) "Install environment: ${env}" | ||
$(INSTALL) "${env}" && echo $(MESSAGE_HAPPY) | ||
|
||
list: ## List of current active services by env | ||
make clean | ||
@echo $(MESSAGE) "List Services: ${env}" | ||
$(LIST) "${env}" && echo $(MESSAGE_HAPPY) | ||
|
||
generate: | ||
$(GENERATE) | ||
lint: ## Clean files unnecesary | ||
make clean | ||
$(LINT) | ||
|
||
test: ## make test | ||
make clean | ||
$(TEST) | ||
|
||
maintainer-clean: distclean | ||
rm -rf $(BIN_DIR) | ||
rm -rf $(ROOT_DIR)/lib/ | ||
up: ## Up application by env | ||
make clean | ||
make verify_network &> /dev/null | ||
@echo $(MESSAGE) "Up Application environment: ${env}" | ||
$(UP) "${env}" && echo $(MESSAGE_HAPPY) | ||
|
||
restart: ## Reload services | ||
@echo $(MESSAGE) "restart Application environment: ${env}" | ||
docker-compose restart | ||
|
||
lintcode: | ||
$(LINTCODE) | ||
ssh: ## Connect to container | ||
docker exec -it $(CONTAINER) bash | ||
|
||
stop: ## stop containers docker by env | ||
make clean | ||
@echo $(MESSAGE) "Stop Services: ${env}" | ||
$(STOP) "${env}" && echo $(MESSAGE_HAPPY) | ||
|
||
watch: | ||
$(WATCH) | ||
setup: ## Install dependences initial | ||
make clean | ||
$(SETUP) | ||
|
||
verify_network: ## Verify network | ||
@if [ -z $$(docker network ls | grep $(DOCKER_NETWORK) | awk '{print $$2}') ]; then\ | ||
(docker network create $(DOCKER_NETWORK));\ | ||
fi | ||
|
||
test: | ||
$(TEST) | ||
help: ## Show help text | ||
@echo $(MESSAGE) "Commands" | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' |
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 |
---|---|---|
@@ -1,25 +1,22 @@ | ||
#!/usr/bin/env bash | ||
# -*- coding: utf-8 -*- | ||
|
||
export PROJECT_NAME='slides-docker4devs' | ||
export PYTHON_VERSION=2.7.9 | ||
export PYENV_NAME="${PROJECT_NAME}" | ||
|
||
export GVM_NAME="${PROJECT_NAME}" | ||
export GVM_PATHS_NAME=( | ||
"src" | ||
"pkg" | ||
"bin" | ||
) | ||
export PROJECT_NAME=slides-docker4devs | ||
export PROJECT_NAME_DEV="${PROJECT_NAME}"-DEV | ||
export PROJECT_NAME_STAGE="${PROJECT_NAME}"-STAGE | ||
export PROJECT_NAME_TEST="${PROJECT_NAME}"-TEST | ||
|
||
export GRIP_PORT=6430 | ||
export PYTHON_VERSION=3.6.1 | ||
export PYENV_NAME="${PROJECT_NAME}" | ||
|
||
# Vars Dir | ||
export ROOT_DIR | ||
ROOT_DIR="$(pwd)" | ||
export RESOURCES_DIR="${SOURCE_DIR}/resources" | ||
export RESOURCES_DB_DIR="${RESOURCES_DIR}/db" | ||
export PROVISION_DIR="${ROOT_DIR}/provision/ansible" | ||
export SOURCE_DIR="${ROOT_DIR}" | ||
export ETC_DIR="${SOURCE_DIR}/etc" | ||
export REQUIREMENTS_DIR="${SOURCE_DIR}/requirements" | ||
ROOT_DIR=$(pwd) | ||
export RESOURCES_DIR="$ROOT_DIR/resources" | ||
export RESOURCES_DB_DIR="$RESOURCES_DIR/db" | ||
export PROVISION_DIR="$ROOT_DIR/provision/ansible" | ||
export SOURCE_DIR="${ROOT_DIR}/" | ||
export REQUIREMENTS_DIR="${ROOT_DIR}/requirements/" | ||
export FILE_README="${ROOT_DIR}/README.rst" | ||
|
||
export MESSAGE="༼ つ ◕_◕ ༽つ" |
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,19 @@ | ||
#!/usr/bin/env bash | ||
# -*- coding: utf-8 -*- | ||
|
||
# shellcheck source=/dev/null | ||
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh" | ||
|
||
cd "${ROOT_DIR}" || echo 'Not Found' | ||
|
||
if [ "$1" == "" ]; then | ||
docker-compose build --no-cache | ||
elif [ "$1" == "dev" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/dev.yml -p "${PROJECT_NAME_DEV}" build --no-cache | ||
elif [ "$1" == "stage" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/stage.yml -p "${PROJECT_NAME_STAGE}" build --no-cache | ||
elif [ "$1" == "test" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/test.yml -p "${PROJECT_NAME_TEST}" build --no-cache | ||
elif [ "$1" == "prod" ]; then | ||
docker-compose -p "${PROJECT_NAME}" build --no-cache | ||
fi |
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
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
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,19 @@ | ||
#!/usr/bin/env bash | ||
# -*- coding: utf-8 -*- | ||
|
||
# shellcheck source=/dev/null | ||
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh" | ||
|
||
cd "${ROOT_DIR}" || echo 'Not Found' | ||
|
||
if [ "$1" == "" ]; then | ||
docker-compose -p "${PROJECT_NAME}" down --remove-orphans | ||
elif [ "$1" == "dev" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/dev.yml -p "${PROJECT_NAME_DEV}" down --remove-orphans | ||
elif [ "$1" == "stage" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/stage.yml -p "${PROJECT_NAME_STAGE}" down --remove-orphans | ||
elif [ "$1" == "test" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/test.yml -p "${PROJECT_NAME_TEST}" down --remove-orphans | ||
elif [ "$1" == "prod" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/prod.yml -p "${PROJECT_NAME}" down --remove-orphans | ||
fi |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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
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,19 @@ | ||
#!/usr/bin/env bash | ||
# -*- coding: utf-8 -*- | ||
|
||
# shellcheck source=/dev/null | ||
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh" | ||
|
||
cd "${ROOT_DIR}" || echo 'Not Found' | ||
|
||
if [ "$1" == "" ]; then | ||
docker-compose ps | ||
elif [ "$1" == "dev" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/dev.yml ps | ||
elif [ "$1" == "stage" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/stage.yml ps | ||
elif [ "$1" == "test" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/test.yml ps | ||
elif [ "$1" == "prod" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/prod.yml ps | ||
fi |
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
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,19 @@ | ||
#!/usr/bin/env bash | ||
# -*- coding: utf-8 -*- | ||
|
||
# shellcheck source=/dev/null | ||
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh" | ||
|
||
cd "${ROOT_DIR}" || echo 'Not Found' | ||
|
||
if [ "$1" == "" ]; then | ||
docker-compose -p "${PROJECT_NAME}" stop | ||
elif [ "$1" == "dev" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/dev.yml -p "${PROJECT_NAME_DEV}" stop | ||
elif [ "$1" == "stage" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/stage.yml -p "${PROJECT_NAME_STAGE}" stop | ||
elif [ "$1" == "test" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/test.yml -p "${PROJECT_NAME_TEST}" stop | ||
elif [ "$1" == "prod" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/prod.yml -p "${PROJECT_NAME}" stop | ||
fi |
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,19 @@ | ||
#!/usr/bin/env bash | ||
# -*- coding: utf-8 -*- | ||
|
||
# shellcheck source=/dev/null | ||
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh" | ||
|
||
cd "${ROOT_DIR}" || echo 'Not Found' | ||
|
||
if [ "$1" == "" ]; then | ||
docker-compose up --remove-orphans | ||
elif [ "$1" == "dev" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/dev.yml -p "${PROJECT_NAME_DEV}" up --remove-orphans | ||
elif [ "$1" == "stage" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/stage.yml -p "${PROJECT_NAME_STAGE}" up --remove-orphans | ||
elif [ "$1" == "test" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/test.yml -p "${PROJECT_NAME_TEST}" up --remove-orphans | ||
elif [ "$1" == "prod" ]; then | ||
docker-compose -f docker-compose.yml -f docker-compose/prod.yml -p "${PROJECT_NAME}" up --remove-orphans | ||
fi |
Oops, something went wrong.