Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Jun 18, 2019. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
Latest commit
50 lines (42 loc) · 1.64 KB
/
Copy pathMakefile
File metadata and controls
50 lines (42 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Project variables
exportPROJECT_NAME ?= lambda-ecs-tasks
# Parameters
exportFUNCTION_NAME ?= ecsTasks
S3_BUCKET ?= returnly-lambdas
AWS_DEFAULT_REGION ?= us-west-1
include Makefile.settings
.PHONY: test build publish clean
test:
@ ${INFO}"Creating lambda build..."
@ docker-compose $(TEST_ARGS) build $(PULL_FLAG) lambda
@ ${INFO}"Copying lambda build..."
@ docker-compose $(TEST_ARGS) up lambda
@ rm -rf build
@ mkdir -p build
@ docker cp $$(docker-compose $(TEST_ARGS) ps -q lambda):/build/src/report.xml build/
@ $(call check_exit_code,$(TEST_ARGS),lambda)
@ docker cp $$(docker-compose $(TEST_ARGS) ps -q lambda):/build/$(FUNCTION_NAME).zip build/
@ ${INFO}"Build complete"
build:
@ ${INFO}"Building $(FUNCTION_NAME).zip..."
@ rm -rf src/vendor
@ cd src && pip install -t vendor/ -r requirements.txt --upgrade
@ mkdir -p build
@ cd src && zip -9 -r ../build/$(FUNCTION_NAME).zip * -x *.pyc -x requirements_test.txt -x tests/ -x tests/**\*
@ ${INFO}"Built build/$(FUNCTION_NAME).zip"
publish:
@ ${INFO}"Publishing $(FUNCTION_NAME).zip to s3://$(S3_BUCKET)..."
@ aws s3 cp --quiet build/$(FUNCTION_NAME).zip s3://$(S3_BUCKET)
@ ${INFO}"Published to S3 URL: https://s3.amazonaws.com/$(S3_BUCKET)/$(FUNCTION_NAME).zip"
@ ${INFO}"S3 Object Version: $(S3_OBJECT_VERSION)"
clean:
${INFO}"Destroying build environment..."
@ docker-compose $(TEST_ARGS) down -v ||true
${INFO}"Removing dangling images..."
@ $(call clean_dangling_images,$(PROJECT_NAME))
@ ${INFO}"Removing all distributions..."
@ rm -rf src/*.pyc src/vendor build
${INFO}"Clean complete"
# IMPORTANT - ensures arguments are not interpreted as make targets
%:
@: