Skip to content

Commit f165a07

Browse files
committed
Merge branch 'v3' into al2023
# Conflicts: # layers/fpm-dev/Dockerfile # php-83/Dockerfile
2 parents 0cafc91 + c1f4bb6 commit f165a07

File tree

26 files changed

+246
-1521
lines changed

26 files changed

+246
-1521
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ jobs:
2828

2929
- name: Get the version
3030
id: get_version
31-
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
31+
run: |
32+
if [[ $GITHUB_REF == refs/tags/* ]]; then
33+
VERSION=${GITHUB_REF#refs/tags/}
34+
elif [[ $GITHUB_REF == refs/heads/* ]]; then
35+
VERSION=${GITHUB_REF#refs/heads/}
36+
else
37+
VERSION=$GITHUB_REF
38+
fi
39+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
3240
3341
# See https://stackoverflow.com/questions/70312490/github-actions-runner-environment-doesnt-build-for-arm-images
3442
- name: Set up QEMU to run ARM images (that were built with Depot)
@@ -39,7 +47,7 @@ jobs:
3947
- name: Configure AWS credentials
4048
uses: aws-actions/configure-aws-credentials@v4
4149
with:
42-
role-to-assume: arn:aws:iam::534081306603:role/bref-layer-publisher-github-actions
50+
role-to-assume: arn:aws:iam::873528684822:role/bref-layer-publisher-github-actions
4351
role-session-name: bref-layer-publisher-github-actions
4452
aws-region: us-east-1
4553

@@ -86,7 +94,7 @@ jobs:
8694
owner: 'brefphp',
8795
repo: 'bref',
8896
workflow_id: 'update-layer-versions.yml',
89-
ref: 'master',
97+
ref: 'v3',
9098
inputs: {
9199
release_url: '${{ github.event.release.url }}',
92100
release_html_url: '${{ github.event.release.html_url }}',
@@ -108,5 +116,5 @@ jobs:
108116
owner: 'brefphp',
109117
repo: 'layers.js',
110118
workflow_id: 'release.yml',
111-
ref: 'main'
119+
ref: 'v3'
112120
})

.github/workflows/tests.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
script: |
2626
const matrix = {
2727
cpu: ['x86', 'arm'],
28-
php_version: ['80', '81', '82', '83', '84'],
28+
php_version: ['82', '83', '84'],
2929
}
3030
3131
// If this is a third-party pull request, skip ARM builds
@@ -73,13 +73,6 @@ jobs:
7373
- name: Test that layers can be exported
7474
run: |
7575
make layer-php-${{ matrix.php_version }}
76-
make layer-php-${{ matrix.php_version }}-fpm
77-
env:
78-
CPU: ${{ matrix.cpu }}
79-
80-
- name: Test that the "console" layer can be exported
81-
run: make layer-console
82-
if: ${{ matrix.php_version == 80 }}
8376
env:
8477
CPU: ${{ matrix.cpu }}
8578

Makefile

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,63 +35,50 @@ default: docker-images layers
3535

3636

3737
# Build Docker images *locally*
38-
docker-images: docker-images-php-80 docker-images-php-81 docker-images-php-82 docker-images-php-83 docker-images-php-84
38+
docker-images: docker-images-php-82 docker-images-php-83 docker-images-php-84
3939
docker-images-php-%:
4040
PHP_VERSION=$* ${BAKE_COMMAND} --load
4141

4242

4343
# Build Lambda layers (zip files) *locally*
44-
layers: layer-php-80 layer-php-81 layer-php-82 layer-php-83 layer-php-84 layer-php-80-fpm layer-php-81-fpm layer-php-82-fpm layer-php-83-fpm layer-php-84-fpm
45-
# Build the console layer only once (x86 and single PHP version)
46-
@if [ ${CPU} = "x86" ]; then \
47-
$(MAKE) layer-console; \
48-
fi
49-
layer-console:
50-
./utils/docker-zip-dir.sh bref/console-zip console
51-
# This rule matches with a wildcard, for example `layer-php-80`.
52-
# The `$*` variable will contained the matched part, in this case `php-80`.
44+
layers: layer-php-82 layer-php-83 layer-php-84
45+
# This rule matches with a wildcard, for example `layer-php-84`.
46+
# The `$*` variable will contained the matched part, in this case `php-84`.
5347
layer-%:
5448
./utils/docker-zip-dir.sh bref/${CPU_PREFIX}$* ${CPU_PREFIX}$*
5549

5650

5751
# Upload the layers to AWS Lambda
5852
# Uses the current AWS_PROFILE. Most users will not want to use this option
5953
# as this will publish all layers to all regions + publish all Docker images.
60-
upload-layers: upload-layers-php-80 upload-layers-php-81 upload-layers-php-82 upload-layers-php-83 upload-layers-php-84
61-
# Upload the console layer only once (x86 and single PHP version)
62-
@if [ ${CPU} = "x86" ]; then \
63-
LAYER_NAME=console $(MAKE) -C ./utils/lambda-publish publish-parallel; \
64-
fi
54+
upload-layers: upload-layers-php-82 upload-layers-php-83 upload-layers-php-84
6555
upload-layers-php-%:
66-
# Upload the function layers to AWS
6756
LAYER_NAME=${CPU_PREFIX}php-$* $(MAKE) -C ./utils/lambda-publish publish-parallel
68-
# Upload the FPM layers to AWS
69-
LAYER_NAME=${CPU_PREFIX}php-$*-fpm $(MAKE) -C ./utils/lambda-publish publish-parallel
7057

7158

7259
# Publish Docker images to Docker Hub.
73-
upload-to-docker-hub: upload-to-docker-hub-php-80 upload-to-docker-hub-php-81 upload-to-docker-hub-php-82 upload-to-docker-hub-php-83 upload-to-docker-hub-php-84
60+
upload-to-docker-hub: upload-to-docker-hub-php-82 upload-to-docker-hub-php-83 upload-to-docker-hub-php-84
7461
upload-to-docker-hub-php-%:
7562
# Make sure we have defined the docker tag
7663
(test $(DOCKER_TAG)) && echo "Tagging images with \"${DOCKER_TAG}\"" || echo "You have to define environment variable DOCKER_TAG"
7764
test $(DOCKER_TAG)
7865

66+
set -e ; \
7967
for image in \
80-
"bref/${CPU_PREFIX}php-$*" "bref/${CPU_PREFIX}php-$*-fpm" "bref/${CPU_PREFIX}php-$*-console" \
81-
"bref/${CPU_PREFIX}build-php-$*" "bref/${CPU_PREFIX}php-$*-fpm-dev"; \
68+
"bref/${CPU_PREFIX}php-$*" "bref/${CPU_PREFIX}build-php-$*" "bref/${CPU_PREFIX}php-$*-dev"; \
8269
do \
8370
docker tag $$image $$image:2 ; \
8471
docker tag $$image $$image:${DOCKER_TAG} ; \
8572
docker push $$image --all-tags ; \
8673
done
8774

8875

89-
test: test-80 test-81 test-82 test-83 test-84
76+
test: test-82 test-83 test-84
9077
test-%:
9178
cd tests && $(MAKE) test-$*
9279

9380

94-
clean: clean-80 clean-81 clean-82 clean-83 clean-84
81+
clean: clean-82 clean-83 clean-84
9582
# Clear the build cache, else all images will be rebuilt using cached layers
9683
docker builder prune
9784
# Remove zip files
@@ -101,7 +88,4 @@ clean-%:
10188
docker image rm --force bref/${CPU_PREFIX}build-php-$* \
10289
bref/${CPU_PREFIX}php-$* \
10390
bref/${CPU_PREFIX}php-$*-zip \
104-
bref/${CPU_PREFIX}php-$*-fpm \
105-
bref/${CPU_PREFIX}php-$*-fpm-zip \
106-
bref/${CPU_PREFIX}php-$*-fpm-dev \
107-
bref/${CPU_PREFIX}php-$*-console
91+
bref/${CPU_PREFIX}php-$*-dev

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ The published Lambda layers will be public (they are readonly anyway). You can f
9494
If you ever need to check out the content of a layer, you can start a `bash` terminal inside the Docker image:
9595

9696
```sh
97-
docker run --rm -it --entrypoint=bash bref/php-80
97+
docker run --rm -it --entrypoint=bash bref/php-84
9898
```
9999

100100
> **Note:**
@@ -148,10 +148,8 @@ Anything we want to make available in AWS Lambda is possible by preparing the ri
148148
bref/ # custom Bref files
149149
extensions/ # PHP extensions
150150
...
151-
php-fpm-runtime/ # the built-in FPM runtime
152151
etc/php/conf.d/ # automatically loaded php.ini files
153152
bref.ini
154-
bootstrap.php # (for the function layer only)
155153

156154
bootstrap # entrypoint of the runtime
157155

docker-bake.hcl

Lines changed: 15 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group "default" {
2-
targets = ["build-php", "php", "php-fpm", "console-zip", "console", "php-fpm-dev"]
2+
targets = ["build-php", "php", "php-dev"]
33
}
44

55
variable "CPU" {
@@ -9,7 +9,7 @@ variable "CPU_PREFIX" {
99
default = ""
1010
}
1111
variable "PHP_VERSION" {
12-
default = "80"
12+
default = "84"
1313
}
1414
variable "IMAGE_VERSION_SUFFIX" {
1515
default = "x86_64"
@@ -23,9 +23,9 @@ variable "PHP_COMPILATION_FLAGS" {
2323

2424
target "build-php" {
2525
dockerfile = "php-${PHP_VERSION}/Dockerfile"
26-
target = "build-environment"
27-
tags = ["bref/${CPU_PREFIX}build-php-${PHP_VERSION}"]
28-
args = {
26+
target = "build-environment"
27+
tags = ["bref/${CPU_PREFIX}build-php-${PHP_VERSION}"]
28+
args = {
2929
"IMAGE_VERSION_SUFFIX" = "${IMAGE_VERSION_SUFFIX}"
3030
"PHP_COMPILATION_FLAGS" = "${PHP_COMPILATION_FLAGS}"
3131
}
@@ -34,9 +34,9 @@ target "build-php" {
3434

3535
target "php" {
3636
dockerfile = "php-${PHP_VERSION}/Dockerfile"
37-
target = "function"
38-
tags = ["bref/${CPU_PREFIX}php-${PHP_VERSION}"]
39-
args = {
37+
target = "function"
38+
tags = ["bref/${CPU_PREFIX}php-${PHP_VERSION}"]
39+
args = {
4040
"IMAGE_VERSION_SUFFIX" = "${IMAGE_VERSION_SUFFIX}"
4141
"PHP_COMPILATION_FLAGS" = "${PHP_COMPILATION_FLAGS}"
4242
}
@@ -46,58 +46,18 @@ target "php" {
4646
platforms = ["${DOCKER_PLATFORM}"]
4747
}
4848

49-
target "php-fpm" {
49+
target "php-dev" {
5050
dockerfile = "php-${PHP_VERSION}/Dockerfile"
51-
target = "fpm"
52-
tags = ["bref/${CPU_PREFIX}php-${PHP_VERSION}-fpm"]
53-
args = {
51+
target = "dev"
52+
tags = ["bref/${CPU_PREFIX}php-${PHP_VERSION}-dev"]
53+
args = {
5454
"IMAGE_VERSION_SUFFIX" = "${IMAGE_VERSION_SUFFIX}"
55+
"PHP_COMPILATION_FLAGS" = "${PHP_COMPILATION_FLAGS}"
5556
}
5657
contexts = {
5758
"bref/${CPU_PREFIX}build-php-${PHP_VERSION}" = "target:build-php"
58-
"bref/${CPU_PREFIX}php-${PHP_VERSION}" = "target:php"
59-
}
60-
platforms = ["${DOCKER_PLATFORM}"]
61-
}
62-
63-
target "console-zip" {
64-
context = "layers/console"
65-
target = "console-zip"
66-
tags = ["bref/console-zip"]
67-
args = {
68-
PHP_VERSION = "${PHP_VERSION}"
69-
CPU_PREFIX = "${CPU_PREFIX}"
70-
}
71-
platforms = ["${DOCKER_PLATFORM}"]
72-
}
73-
74-
target "console" {
75-
context = "layers/console"
76-
target = "console"
77-
tags = ["bref/${CPU_PREFIX}php-${PHP_VERSION}-console"]
78-
args = {
79-
PHP_VERSION = "${PHP_VERSION}"
80-
CPU_PREFIX = "${CPU_PREFIX}"
81-
}
82-
contexts = {
83-
"bref/${CPU_PREFIX}build-php-${PHP_VERSION}" = "target:build-php"
84-
"bref/${CPU_PREFIX}php-${PHP_VERSION}" = "target:php"
85-
}
86-
platforms = ["${DOCKER_PLATFORM}"]
87-
}
88-
89-
target "php-fpm-dev" {
90-
context = "layers/fpm-dev"
91-
tags = ["bref/${CPU_PREFIX}php-${PHP_VERSION}-fpm-dev"]
92-
args = {
93-
PHP_VERSION = "${PHP_VERSION}"
94-
CPU_PREFIX = "${CPU_PREFIX}"
95-
}
96-
contexts = {
97-
"bref/${CPU_PREFIX}build-php-${PHP_VERSION}" = "target:build-php"
98-
"bref/${CPU_PREFIX}php-${PHP_VERSION}" = "target:php"
99-
"bref/${CPU_PREFIX}php-${PHP_VERSION}-fpm" = "target:php-fpm"
100-
"bref/local-api-gateway" = "docker-image://bref/local-api-gateway:latest"
59+
"bref/${CPU_PREFIX}php-${PHP_VERSION}" = "target:php"
60+
"bref/local-api-gateway" = "docker-image://bref/local-api-gateway:latest"
10161
}
10262
platforms = ["${DOCKER_PLATFORM}"]
10363
}

layers/console/Dockerfile

Lines changed: 0 additions & 22 deletions
This file was deleted.

layers/console/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

layers/console/bootstrap.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

layers/fpm-dev/Dockerfile

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)