-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
96 lines (71 loc) · 1.96 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
.PHONY: install prepare sync clean clean-export build publish publish-canary publish-experimental test lambda
OS_NAME := $(shell uname -s | tr A-Z a-z)
ifeq ($(OS_NAME),darwin)
SED_ARGS := "-i '' -e"
else
SED_ARGS := "-i"
endif
install:
npm ci
prepare:
git clone https://github.com/brefphp/bref.git build/bref
sync:
git -C build/bref reset --hard HEAD
git -C build/bref pull
clean:
rm -rf build/bref
clean-export:
rm -rf build/bref/runtime/export/tmp/**
build:
# Just build from Docker hub
sed ${SED_ARGS} 's/export\/php%.zip: docker-images/export\/php%.zip:/g' build/bref/runtime/Makefile
# Create binaries
cd build/bref/runtime && make export/php-80-fpm.zip
# Ensure folder
mkdir -p native
# Cleanup folder
rm -rf native/**
# Extract binaries
unzip build/bref/runtime/export/php-80-fpm.zip -d native
# Download composer
curl -o native/bin/composer https://getcomposer.org/composer-stable.phar
chmod +x native/bin/composer
# Replace PHP paths
#sed -i '' -e "s/\/opt\/bin\/php/\/var\/task\/native\/bref\/bin\/php/g" ./native/bootstrap
# Remove brefphp's bootstrap
rm ./native/bootstrap
# Use our tuned brefphp bootstrap
cp lib/brefphp ./native
# Use our tuned PHP ini
cp lib/vercel.ini ./native/bref/etc/php/conf.d/vercel.ini
# Remove previous native build pack
rm native.zip || true
# Create native build pack
zip --symlinks -r native.zip native
publish:
rm -rf ./dist
npm publish --access public --tag latest
publish-dry:
rm -rf ./dist
npm publish --dry
publish-canary:
rm -rf ./dist
npm version --no-git-tag-version patch
npm publish --access public --tag canary
publish-experimental:
rm -rf ./dist
npm version --no-git-tag-version patch
npm publish --access public --tag experimental
test:
npm run build
npm run test
lambda:
docker run \
-it \
--rm \
-v $(CURDIR)/native:/var/task/native \
-v $(CURDIR)/lib/bootstrap:/var/task/bootstrap \
-w /var/task \
--entrypoint /bin/bash \
-p 8000:8000 \
lambci/lambda:nodejs12.x