1
1
# ###### PHP custom runtime #######
2
2
3
+ # ###### Install and compile everything #######
4
+
3
5
# Same AL version as Lambda execution environment AMI
4
- FROM amazonlinux:2017.03.1.20170812 as customruntime
6
+ FROM amazonlinux:2017.03.1.20170812 as builder
5
7
6
8
# Lock to 2017.03 release (same as Lambda) and install compilation dependencies
7
9
RUN sed -i 's;^releasever.*;releasever=2017.03;;' /etc/yum.conf && \
8
10
yum clean all && \
9
- yum install autoconf bison gcc gcc-c++ make libcurl-devel libxml2-devel openssl-devel tar gzip -y
11
+ yum install -y autoconf \
12
+ bison \
13
+ gcc \
14
+ gcc-c++ \
15
+ make \
16
+ libcurl-devel \
17
+ libxml2-devel \
18
+ openssl-devel \
19
+ tar \
20
+ gzip \
21
+ zip \
22
+ unzip \
23
+ git
10
24
11
- # Download the PHP 7.3.0 source, compile it , and install to /opt/php-7-bin
25
+ # Download the PHP 7.3.0 source, compile, and install
12
26
RUN mkdir ~/php-7-bin && \
13
27
curl -sL https://github.com/php/php-src/archive/php-7.3.0.tar.gz | tar -xvz && \
14
28
cd php-src-php-7.3.0 && \
@@ -17,6 +31,16 @@ RUN mkdir ~/php-7-bin && \
17
31
make install && \
18
32
/opt/php-7-bin/bin/php -v
19
33
20
- # ##### Something else ######
34
+ WORKDIR /runtime
35
+ RUN mkdir bin && \
36
+ cp /opt/php-7-bin/bin/php bin/php
37
+
38
+ # Install composer and guzzle lib
39
+ RUN curl -sS https://getcomposer.org/installer | ./bin/php -- --install-dir=/runtime/bin --filename=composer && \
40
+ ./bin/php ./bin/composer require guzzlehttp/guzzle
41
+
42
+ # ##### Create runtime image ######
43
+
44
+ FROM lambci/lambda:provided as runtime
21
45
22
- FROM lambci/lambda:provided
46
+ COPY --from=builder /runtime /opt
0 commit comments