Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Layer to support Symfony Runtime component #889

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ publish-docker-images: docker-images
test $(DOCKER_TAG)

for image in \
"bref/php-73" "bref/php-73-fpm" "bref/php-73-console" "bref/php-73-fpm-dev" \
"bref/php-74" "bref/php-74-fpm" "bref/php-74-console" "bref/php-74-fpm-dev" \
"bref/php-80" "bref/php-80-fpm" "bref/php-80-console" "bref/php-80-fpm-dev" \
"bref/php-81" "bref/php-81-fpm" "bref/php-81-console" "bref/php-81-fpm-dev" \
"bref/php-73" "bref/php-73-runtime" "bref/php-73-fpm" "bref/php-73-console" "bref/php-73-fpm-dev" \
"bref/php-74" "bref/php-74-runtime" "bref/php-74-fpm" "bref/php-74-console" "bref/php-74-fpm-dev" \
"bref/php-80" "bref/php-80-runtime" "bref/php-80-fpm" "bref/php-80-console" "bref/php-80-fpm-dev" \
"bref/php-81" "bref/php-81-runtime" "bref/php-81-fpm" "bref/php-81-console" "bref/php-81-fpm-dev" \
"bref/build-php-73" \
"bref/build-php-74" \
"bref/build-php-80" \
Expand Down
7 changes: 6 additions & 1 deletion runtime/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish: layers
cd layers ; php publish.php

# Build the layers
layers: export/console.zip export/php-73.zip export/php-74.zip export/php-80.zip export/php-81.zip export/php-73-fpm.zip export/php-74-fpm.zip export/php-80-fpm.zip export/php-81-fpm.zip
layers: export/console.zip export/php-73.zip export/php-74.zip export/php-80.zip export/php-81.zip export/php-73-runtime.zip export/php-74-runtime.zip export/php-80-runtime.zip export/php-81-runtime.zip export/php-73-fpm.zip export/php-74-fpm.zip export/php-80-fpm.zip export/php-81-fpm.zip

# The PHP runtimes
export/php%.zip: docker-images
Expand Down Expand Up @@ -58,6 +58,11 @@ docker-images:
cd layers/console ; docker build -t bref/php-74-console --build-arg PHP_VERSION=74 .
cd layers/console ; docker build -t bref/php-80-console --build-arg PHP_VERSION=80 .
cd layers/console ; docker build -t bref/php-81-console --build-arg PHP_VERSION=81 .
# - sf-runtime
cd layers/sf-runtime ; docker build -t bref/php-73-runtime --build-arg PHP_VERSION=73 .
cd layers/sf-runtime ; docker build -t bref/php-74-runtime --build-arg PHP_VERSION=74 .
cd layers/sf-runtime ; docker build -t bref/php-80-runtime --build-arg PHP_VERSION=80 .
cd layers/sf-runtime ; docker build -t bref/php-81-runtime --build-arg PHP_VERSION=81 .
# Other Docker images
cd layers/fpm-dev ; docker build -t bref/php-73-fpm-dev --build-arg PHP_VERSION=73 .
cd layers/fpm-dev ; docker build -t bref/php-74-fpm-dev --build-arg PHP_VERSION=74 .
Expand Down
4 changes: 4 additions & 0 deletions runtime/layers/layer-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@

const LAYER_NAMES = [
'php-81',
'php-81-runtime',
'php-81-fpm',
'php-80',
'php-80-runtime',
'php-80-fpm',
'php-74',
'php-74-runtime',
'php-74-fpm',
'php-73',
'php-73-runtime',
'php-73-fpm',
'console',
];
Expand Down
4 changes: 4 additions & 0 deletions runtime/layers/publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@

$layers = [
'php-81' => 'PHP 8.1 for event-driven PHP functions',
'php-81-runtime' => 'PHP 8.1 for PHP applications using Symfony Runtime',
'php-81-fpm' => 'PHP-FPM 8.1 for web applications',
'php-80' => 'PHP 8.0 for event-driven PHP functions',
'php-80-runtime' => 'PHP 8.0 for PHP applications using Symfony Runtime',
'php-80-fpm' => 'PHP-FPM 8.0 for web applications',
'php-74' => 'PHP 7.4 for event-driven PHP functions',
'php-74-runtime' => 'PHP 7.4 for PHP applications using Symfony Runtime',
'php-74-fpm' => 'PHP-FPM 7.4 for web applications',
'php-73' => 'PHP 7.3 for event-driven PHP functions',
'php-73-runtime' => 'PHP 7.3 for PHP applications using Symfony Runtime',
'php-73-fpm' => 'PHP-FPM 7.3 for web applications',
'console' => 'Console runtime for PHP applications',
];
Expand Down
7 changes: 7 additions & 0 deletions runtime/layers/sf-runtime/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG PHP_VERSION
FROM bref/php-$PHP_VERSION

# Overwrite the original bootstrap
COPY bootstrap /opt/bootstrap
# Copy files to /var/runtime to support deploying as a Docker image
RUN cp /opt/bootstrap /var/runtime
13 changes: 13 additions & 0 deletions runtime/layers/sf-runtime/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# Fail on error
set -e

LAMBDA_ARGV=(${_HANDLER//:/ })

while true
do
# We redirect stderr to stdout so that everything
# written on the output ends up in Cloudwatch automatically
/opt/bin/php "${LAMBDA_ARGV[0]}" 2>&1
done
4 changes: 4 additions & 0 deletions runtime/layers/tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
'bref/php-74',
'bref/php-80',
'bref/php-81',
'bref/php-73-runtime',
'bref/php-74-runtime',
'bref/php-80-runtime',
'bref/php-81-runtime',
'bref/php-73-fpm',
'bref/php-74-fpm',
'bref/php-80-fpm',
Expand Down