@@ -22,30 +22,35 @@ RUN sed -i 's;^releasever.*;releasever=2017.03;;' /etc/yum.conf && \
22
22
unzip \
23
23
git
24
24
25
- # Download the PHP 7.3.0 source, compile, and install
26
- RUN mkdir ~/php-7-bin && \
27
- curl -sL https://github.com/php/php-src/archive/php-7.3.0.tar.gz | tar -xvz && \
25
+ # Download the PHP 7.3.0 source, compile, and install both PHP and Composer
26
+ RUN curl -sL https://github.com/php/php-src/archive/php-7.3.0.tar.gz | tar -xvz && \
28
27
cd php-src-php-7.3.0 && \
29
28
./buildconf --force && \
30
29
./configure --prefix=/opt/php-7-bin/ --with-openssl --with-curl --with-zlib && \
31
30
make install && \
32
- /opt/php-7-bin/bin/php -v
31
+ /opt/php-7-bin/bin/php -v && \
32
+ curl -sS https://getcomposer.org/installer | /opt/php-7-bin/bin/php -- --install-dir=/opt/php-7-bin/bin/ --filename=composer
33
33
34
34
# Prepare runtime files
35
- WORKDIR /runtime
36
- RUN mkdir bin && \
37
- cp /opt/php-7-bin/bin/php bin/php
35
+ RUN mkdir -p /lambda-php-runtime/bin && \
36
+ cp /opt/php-7-bin/bin/php /lambda-php-runtime/bin/php
38
37
39
- RUN curl -sS https://getcomposer.org/installer | ./bin/php -- --install-dir=/runtime/bin --filename=composer && \
40
- ./bin/php ./bin/composer require guzzlehttp/guzzle
38
+ COPY runtime/bootstrap /lambda-php-runtime/
39
+
40
+ # Install Guzzle, prepare vendor files
41
+ RUN mkdir /lambda-php-vendor && \
42
+ cd /lambda-php-vendor && \
43
+ /opt/php-7-bin/bin/php /opt/php-7-bin/bin/composer require guzzlehttp/guzzle
41
44
42
45
# ##### Create runtime image ######
43
46
44
47
FROM lambci/lambda:provided as runtime
45
48
46
- COPY --from=builder /runtime/ /opt/
49
+ # Layer 1
50
+ COPY --from=builder /lambda-php-runtime /opt/
47
51
48
- COPY runtime/bootstrap /opt/
52
+ # Layer 2
53
+ COPY --from=builder /lambda-php-vendor/vendor /opt/vendor
49
54
50
55
# ##### Create function image ######
51
56
0 commit comments