Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit 3d48388

Browse files
committed
Create function image
1 parent f746086 commit 3d48388

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,24 @@ RUN mkdir ~/php-7-bin && \
3131
make install && \
3232
/opt/php-7-bin/bin/php -v
3333

34+
# Prepare runtime files
3435
WORKDIR /runtime
3536
RUN mkdir bin && \
3637
cp /opt/php-7-bin/bin/php bin/php
3738

38-
# Install composer and guzzle lib
3939
RUN curl -sS https://getcomposer.org/installer | ./bin/php -- --install-dir=/runtime/bin --filename=composer && \
4040
./bin/php ./bin/composer require guzzlehttp/guzzle
4141

42-
# Copy in runtime bootstrap
43-
COPY runtime/bootstrap /runtime/
44-
4542
###### Create runtime image ######
4643

4744
FROM lambci/lambda:provided as runtime
4845

4946
COPY --from=builder /runtime/ /opt/
47+
48+
COPY runtime/bootstrap /opt/
49+
50+
###### Create function image ######
51+
52+
FROM runtime as function
53+
54+
COPY function/ /var/task/src/

function/goodbye.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
function goodbye($data)
4+
{
5+
return "Goodbye, {$data['name']}!";
6+
}
7+
8+
?>

function/hello.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
function hello($data)
4+
{
5+
return "Hello, {$data['name']}!";
6+
}
7+
8+
?>

runtime/bootstrap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ do {
3939
// Submit the response back to the runtime API.
4040
sendResponse($request['invocationId'], $response);
4141
} while (true);
42+
43+
?>

0 commit comments

Comments
 (0)