|
1 | 1 | SHELL := /bin/bash |
2 | | -.PHONY: build build-images publish |
| 2 | +.PHONY: build publish publish-images publish-dev-images |
3 | 3 |
|
4 | | -build: build-php-72.zip build-php-73.zip build-php-74.zip build-php-80.zip build-php-81.zip build-php-82.zip build-php-83.zip build-php-84.zip build-php-85.zip |
| 4 | +PHP_VERSIONS := 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5 |
5 | 5 |
|
6 | | -build-php%.zip: publish-images |
7 | | - PHP_VERSION=$$(echo $@ | cut -d'.' -f 1 | cut -d'-' -f 2,3); \ |
8 | | - rm ${PWD}/../build/$$PHP_VERSION.zip; \ |
9 | | - rm ${PWD}/../build/arm-$$PHP_VERSION.zip; \ |
10 | | - docker run --rm --platform linux/amd64 --entrypoint "/export.sh" --env ARCHIVE_FILENAME=$$PHP_VERSION --volume ${PWD}/../:/ymir --volume ${PWD}/export.sh:/export.sh:ro ymirapp/php-runtime:$$PHP_VERSION .; \ |
11 | | - docker run --rm --platform linux/arm64 --entrypoint "/export.sh" --env ARCHIVE_FILENAME=arm-$$PHP_VERSION --volume ${PWD}/../:/ymir --volume ${PWD}/export.sh:/export.sh:ro ymirapp/arm-php-runtime:$$PHP_VERSION . |
| 6 | +build: $(addprefix build-php-, $(PHP_VERSIONS)) |
| 7 | + |
| 8 | +build-php-%: |
| 9 | + $(eval PHP_VER := $*) |
| 10 | + $(eval PHP_DIR := php-$(shell echo $* | sed 's/\.//g')) |
| 11 | + @echo "Building PHP $(PHP_VER)..." |
| 12 | + rm -f ${PWD}/../build/$(PHP_VER).zip |
| 13 | + rm -f ${PWD}/../build/arm-$(PHP_VER).zip |
| 14 | + # Build x86_64 |
| 15 | + depot build -t ymirapp/php-runtime:php-$(PHP_VER) -f $(PHP_DIR)/Dockerfile . --load --build-arg CPU_ARCHITECTURE=x86_64 --build-arg DOCKER_PLATFORM=linux/amd64 |
| 16 | + docker run --rm --platform linux/amd64 --entrypoint "/export.sh" --env ARCHIVE_FILENAME=$(PHP_VER) --volume ${PWD}/../:/ymir --volume ${PWD}/export.sh:/export.sh:ro ymirapp/php-runtime:php-$(PHP_VER) . |
| 17 | + # Build arm64 |
| 18 | + depot build -t ymirapp/arm-php-runtime:php-$(PHP_VER) -f $(PHP_DIR)/Dockerfile . --load --build-arg CPU_ARCHITECTURE=arm64 --build-arg DOCKER_PLATFORM=linux/arm64 |
| 19 | + docker run --rm --platform linux/arm64 --entrypoint "/export.sh" --env ARCHIVE_FILENAME=arm-$(PHP_VER) --volume ${PWD}/../:/ymir --volume ${PWD}/export.sh:/export.sh:ro ymirapp/arm-php-runtime:php-$(PHP_VER) . |
12 | 20 |
|
13 | 21 | publish-images-%: |
14 | | - CPU_ARCHITECTURE=$$(echo '$*' | cut -d '-' -f 2); \ |
15 | | - DOCKER_PLATFORM=$$(echo '$*' | cut -d '-' -f 1 | sed 's/_/\//'); \ |
16 | | - if [ "$$CPU_ARCHITECTURE" = "x86_64" ]; then \ |
17 | | - RUNTIME_REPO="ymirapp/php-runtime"; \ |
18 | | - else \ |
19 | | - RUNTIME_REPO="ymirapp/arm-php-runtime"; \ |
20 | | - fi; \ |
21 | | - cd base ; depot build -t ymirapp/base:$$CPU_ARCHITECTURE . --push --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
22 | | - cd ../php-72 ; depot build -t $$RUNTIME_REPO:php-72 . --load --push --build-arg BASE_IMAGE=base --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
23 | | - cd ../php-73 ; depot build -t $$RUNTIME_REPO:php-73 . --load --push --build-arg BASE_IMAGE=base --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
24 | | - cd ../php-74 ; depot build -t $$RUNTIME_REPO:php-74 . --load --push --build-arg BASE_IMAGE=base --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
25 | | - cd ../php-80 ; depot build -t $$RUNTIME_REPO:php-80 . --load --push --build-arg BASE_IMAGE=base --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
26 | | - cd ../php-81 ; depot build -t $$RUNTIME_REPO:php-81 . --load --push --build-arg BASE_IMAGE=base --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
27 | | - cd ../php-82 ; depot build -t $$RUNTIME_REPO:php-82 . --load --push --build-arg BASE_IMAGE=base --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
28 | | - cd ../php-83 ; depot build -t $$RUNTIME_REPO:php-83 . --load --push --build-arg BASE_IMAGE=base --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
29 | | - cd ../php-84 ; depot build -t $$RUNTIME_REPO:php-84 . --load --push --build-arg BASE_IMAGE=base --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
30 | | - cd ../php-85 ; depot build -t $$RUNTIME_REPO:php-85 . --load --push --build-arg BASE_IMAGE=base --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE |
| 22 | + $(eval CPU_ARCHITECTURE := $(shell echo '$*' | cut -d '-' -f 2)) |
| 23 | + $(eval DOCKER_PLATFORM := $(shell echo '$*' | cut -d '-' -f 1 | sed 's/_/\//')) |
| 24 | + $(eval RUNTIME_REPO := $(if $(filter x86_64,$(CPU_ARCHITECTURE)),ymirapp/php-runtime,ymirapp/arm-php-runtime)) |
| 25 | + @for ver in $(PHP_VERSIONS); do \ |
| 26 | + PHP_DIR=php-$$(echo $$ver | sed 's/\.//g'); \ |
| 27 | + echo "Publishing PHP $$ver for $(CPU_ARCHITECTURE)..."; \ |
| 28 | + depot build -t $(RUNTIME_REPO):php-$$ver -f $$PHP_DIR/Dockerfile . --push --platform=$(DOCKER_PLATFORM) --build-arg DOCKER_PLATFORM=$(DOCKER_PLATFORM) --build-arg CPU_ARCHITECTURE=$(CPU_ARCHITECTURE); \ |
| 29 | + done |
31 | 30 |
|
32 | 31 | publish-images: publish-images-linux_amd64-x86_64 publish-images-linux_arm64-arm64 |
33 | 32 |
|
34 | 33 | publish-dev-images-%: |
35 | | - CPU_ARCHITECTURE=$$(echo '$*' | cut -d '-' -f 2); \ |
36 | | - DOCKER_PLATFORM=$$(echo '$*' | cut -d '-' -f 1 | sed 's/_/\//'); \ |
37 | | - if [ "$$CPU_ARCHITECTURE" = "x86_64" ]; then \ |
38 | | - RUNTIME_REPO="ymirapp/php-runtime-dev"; \ |
39 | | - else \ |
40 | | - RUNTIME_REPO="ymirapp/arm-php-runtime-dev"; \ |
41 | | - fi; \ |
42 | | - cd base ; depot build -t ymirapp/base-dev:$$CPU_ARCHITECTURE . --push --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
43 | | - cd ../php-72 ; depot build -t $$RUNTIME_REPO:php-72 . --load --push --build-arg BASE_IMAGE=base-dev --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
44 | | - cd ../php-73 ; depot build -t $$RUNTIME_REPO:php-73 . --load --push --build-arg BASE_IMAGE=base-dev --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
45 | | - cd ../php-74 ; depot build -t $$RUNTIME_REPO:php-74 . --load --push --build-arg BASE_IMAGE=base-dev --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
46 | | - cd ../php-80 ; depot build -t $$RUNTIME_REPO:php-80 . --load --push --build-arg BASE_IMAGE=base-dev --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
47 | | - cd ../php-81 ; depot build -t $$RUNTIME_REPO:php-81 . --load --push --build-arg BASE_IMAGE=base-dev --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
48 | | - cd ../php-82 ; depot build -t $$RUNTIME_REPO:php-82 . --load --push --build-arg BASE_IMAGE=base-dev --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
49 | | - cd ../php-83 ; depot build -t $$RUNTIME_REPO:php-83 . --load --push --build-arg BASE_IMAGE=base-dev --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
50 | | - cd ../php-84 ; depot build -t $$RUNTIME_REPO:php-84 . --load --push --build-arg BASE_IMAGE=base-dev --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE; \ |
51 | | - cd ../php-85 ; depot build -t $$RUNTIME_REPO:php-85 . --load --push --build-arg BASE_IMAGE=base-dev --platform=$$DOCKER_PLATFORM --build-arg DOCKER_PLATFORM=$$DOCKER_PLATFORM --build-arg CPU_ARCHITECTURE=$$CPU_ARCHITECTURE |
| 34 | + $(eval CPU_ARCHITECTURE := $(shell echo '$*' | cut -d '-' -f 2)) |
| 35 | + $(eval DOCKER_PLATFORM := $(shell echo '$*' | cut -d '-' -f 1 | sed 's/_/\//')) |
| 36 | + $(eval RUNTIME_REPO := $(if $(filter x86_64,$(CPU_ARCHITECTURE)),ymirapp/php-runtime-dev,ymirapp/arm-php-runtime-dev)) |
| 37 | + @for ver in $(PHP_VERSIONS); do \ |
| 38 | + PHP_DIR=php-$$(echo $$ver | sed 's/\.//g'); \ |
| 39 | + echo "Publishing Dev PHP $$ver for $(CPU_ARCHITECTURE)..."; \ |
| 40 | + depot build -t $(RUNTIME_REPO):php-$$ver -f $$PHP_DIR/Dockerfile . --push --platform=$(DOCKER_PLATFORM) --build-arg DOCKER_PLATFORM=$(DOCKER_PLATFORM) --build-arg CPU_ARCHITECTURE=$(CPU_ARCHITECTURE); \ |
| 41 | + done |
52 | 42 |
|
53 | 43 | publish-dev-images: publish-dev-images-linux_amd64-x86_64 publish-dev-images-linux_arm64-arm64 |
54 | 44 |
|
|
0 commit comments