forked from aws/aws-sam-build-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (62 loc) · 2.16 KB
/
Makefile
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Default value for environment variable. Can be overridden by setting the
# environment variable.
export DOCKER_CONTENT_TRUST := 0
export DOCKER_CLI_EXPERIMENTAL := enabled
# image suffix lookup
IS_java8 := java8
IS_provided := provided
IS_python37 := python3.7
IS_go1x := go1.x
IS_dotnet6 := dotnet6
IS_dotnet7 := dotnet7
IS_java8_al2 := java8.al2
IS_java11 := java11
IS_java17 := java17
IS_nodejs12x := nodejs12.x
IS_nodejs14x := nodejs14.x
IS_nodejs16x := nodejs16.x
IS_nodejs18x := nodejs18.x
IS_provided_al2 := provided.al2
IS_python38 := python3.8
IS_python39 := python3.9
IS_python310 := python3.10
IS_python311 := python3.11
IS_ruby27 := ruby2.7
IS_ruby32 := ruby3.2
init:
pip install -Ur requirements.txt
build:
cd build-image-src && ./build_all_images.sh
pre-build:
ifeq ($(strip $(SAM_CLI_VERSION)),)
@echo "Must specify SAM_CLI_VERSION"
exit 1
else
@echo "SAM CLI VERSION $(SAM_CLI_VERSION)"
endif
ifeq ($(strip $(RUNTIME)),)
@echo "Must specify RUNTIME"
exit 1
else
@echo "Building runtime $(RUNTIME)"
endif
build-single-arch: pre-build
docker build -f build-image-src/Dockerfile-$(RUNTIME) -t amazon/aws-sam-cli-build-image-$(IS_$(RUNTIME)):x86_64 --build-arg SAM_CLI_VERSION=$(SAM_CLI_VERSION) ./build-image-src
build-multi-arch: pre-build
docker build -f build-image-src/Dockerfile-$(RUNTIME) -t amazon/aws-sam-cli-build-image-$(IS_$(RUNTIME)):x86_64 --platform linux/amd64 --build-arg SAM_CLI_VERSION=$(SAM_CLI_VERSION) --build-arg AWS_CLI_ARCH=x86_64 --build-arg IMAGE_ARCH=x86_64 ./build-image-src
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker build -f build-image-src/Dockerfile-$(RUNTIME) -t amazon/aws-sam-cli-build-image-$(IS_$(RUNTIME)):arm64 --platform linux/arm64 --build-arg SAM_CLI_VERSION=$(SAM_CLI_VERSION) --build-arg AWS_CLI_ARCH=aarch64 --build-arg IMAGE_ARCH=arm64 ./build-image-src
test: pre-build
pytest tests -vv -m $(RUNTIME)
lint:
# Linter performs static analysis to catch latent bugs
pylint --rcfile .pylintrc tests
# mypy performs type check
mypy tests/*.py
dev: lint test
black:
black tests
black-check:
black --check tests
# Verifications to run before sending a pull request
pr: init build black-check dev