Set up a new sub-make project for building the nginx-based proxy

This commit also contains some re-organization of the primary Makefile to be a
bit more organized

Work in progress on #39
This commit is contained in:
R. Tyler Croy 2017-08-26 12:51:12 -07:00
parent aed38504d3
commit ea6ecd68b0
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
4 changed files with 60 additions and 23 deletions

View File

@ -1 +1,4 @@
build/repos
webapp/
proxy/
assets/

View File

@ -1,22 +1,59 @@
IMAGE_PREFIX="rtyler/codevalet"
check: generate plans validate
check: generate validate
$(MAKE) -C webapp check
$(MAKE) -C proxy check
all: plugins master
all: plugins master proxy
plugins: ./scripts/build-plugins plugins.txt builder
./scripts/build-plugins
generate: generate-tfs generate-k8s
clean:
rm -f build/git-refs.txt k8/generated
$(MAKE) -C webapp clean
$(MAKE) -C proxy clean
## Build the Jenkins master image
###############################################################
builder: Dockerfile.builder
docker build -t ${IMAGE_PREFIX}-$@ -f Dockerfile.$@ .
master: Dockerfile.master build/git-refs.txt agent-templates
docker build -t ${IMAGE_PREFIX}-$@ -f Dockerfile.$@ .
plugins: ./scripts/build-plugins plugins.txt builder
./scripts/build-plugins
build/git-refs.txt:
./scripts/record-sha1sums
###############################################################
## Handling for agent-templates which is an external repository
###############################################################
agent-templates: build/agent-templates
(cd build/agent-templates && git pull --rebase)
docker run --rm -v $(PWD):$(PWD) -w $(PWD) ruby:2-alpine \
ruby ./scripts/render-agent-templates build/agent-templates
build/agent-templates:
git clone --depth 1 https://github.com/codevalet/agent-templates.git build/agent-templates
###############################################################
## Handle sub-projects
###############################################################
proxy:
$(MAKE) -C proxy
webapp:
$(MAKE) -C webapp
###############################################################
## Terraform
###############################################################
validate: plans/*.tf generate-tfs
./scripts/terraform validate plans
@ -26,14 +63,16 @@ plan: validate
deploy: plan
./scripts/terraform apply --var-file=.terraform.json plans
generate: generate-tfs generate-k8s
generate-tfs: monkeys.txt
@for m in $(shell cat monkeys.txt); do \
echo ">> Generating Terraform resources for $$m" ; \
cat plans/master.tf.template | sed "s/@@USER@@/$$m/" > plans/generated.$$m.tf ; \
done;
###############################################################
## Kubernetes
###############################################################
generate-k8s: monkeys.txt k8s/generated
@for m in $(shell cat monkeys.txt); do \
echo ">> Generating kubernetes resources for $$m" ; \
@ -59,25 +98,9 @@ deploy-k8s: .kube/config generate-k8s
k8s/generated:
mkdir -p k8s/generated
webapp:
$(MAKE) -C webapp
## Handling for agent-templates which is an external repository
###############################################################
agent-templates: build/agent-templates
(cd build/agent-templates && git pull --rebase)
docker run --rm -v $(PWD):$(PWD) -w $(PWD) ruby:2-alpine \
ruby ./scripts/render-agent-templates build/agent-templates
build/agent-templates:
git clone --depth 1 https://github.com/codevalet/agent-templates.git build/agent-templates
###############################################################
clean:
rm -f build/git-refs.txt k8/generated
$(MAKE) -C webapp clean
.PHONY: clean all plugins master builder plan validate \
deploy generate-k8s deploy-k8s webapp check generate-tfs generate \
agent-templates
agent-templates proxy run

2
proxy/Dockerfile Normal file
View File

@ -0,0 +1,2 @@
FROM nginx:alpine

9
proxy/Makefile Normal file
View File

@ -0,0 +1,9 @@
IMAGE_PREFIX="rtyler/codevalet"
check: container
container: Dockerfile
docker build -t ${IMAGE_PREFIX}-proxy .
.PHONY: clean check container