Skip to content

Commit

Permalink
Adding Layer to support Symfony Runtime component
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm committed Mar 20, 2021
1 parent 2d1d56e commit 340415a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
11 changes: 10 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-73-fpm.zip export/php-74-fpm.zip export/php-80-fpm.zip
layers: export/console.zip export/runtime.zip export/php-73.zip export/php-74.zip export/php-80.zip export/php-73-fpm.zip export/php-74-fpm.zip export/php-80-fpm.zip

# The PHP runtimes
export/php%.zip: docker-images
Expand All @@ -28,6 +28,11 @@ export/console.zip: layers/console/bootstrap
rm -f export/console.zip
cd layers/console && zip ../../export/console.zip bootstrap

# The "Symfony runtime" runtime
export/runtime.zip: layers/sf-runtime/bootstrap
rm -f export/runtime.zip
cd layers/sf-runtime && zip ../../export/runtime.zip bootstrap

# Build Docker images
docker-images:
# Build the base environment (without PHP)
Expand All @@ -53,6 +58,10 @@ docker-images:
cd layers/console ; docker build -t bref/php-73-console --build-arg PHP_VERSION=73 .
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 .
# - 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 .
# 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
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

0 comments on commit 340415a

Please sign in to comment.