This repository was archived by the owner on Apr 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 140
/
Copy pathDockerfile
49 lines (42 loc) · 1.56 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#Lambda base image Amazon linux
FROM public.ecr.aws/lambda/provided as builder
# Set desired PHP Version
ARG php_version="8.3.1"
ARG php_path="/var/lang/"
ARG lambda_runtime_path="/var/runtime"
ARG lambda_task_path="/var/task"
RUN dnf clean all && \
dnf install -y autoconf \
bison \
bzip2-devel \
gcc \
gcc-c++ \
git \
gzip \
libcurl-devel \
libxml2-devel \
make \
openssl-devel \
tar \
unzip \
zip \
re2c \
sqlite-devel \
oniguruma-devel
# Download the PHP source, compile, and install both PHP and Composer
RUN curl -sL https://github.com/php/php-src/archive/php-${php_version}.tar.gz | tar -xvz && \
cd php-src-php-${php_version} && \
./buildconf --force && \
./configure --prefix=${php_path} --with-openssl --with-curl --with-zlib --without-pear --enable-bcmath --with-bz2 --enable-mbstring --with-mysqli && \
make -j 5 && \
make install && \
${php_path}/bin/php -v && \
curl -sS https://getcomposer.org/installer | ${php_path}/bin/php -- --install-dir=${php_path}/bin/ --filename=composer
# Prepare runtime files
COPY runtime/bootstrap ${lambda_runtime_path}
RUN chmod 0755 ${lambda_runtime_path}/bootstrap
# Install Guzzle, prepare vendor files
RUN cd /opt && \
${php_path}/bin/php ${php_path}/bin/composer require guzzlehttp/guzzle
COPY src/ ${lambda_task_path}
CMD [ "index.handler" ]