-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (35 loc) · 1.44 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
FROM amazon/aws-lambda-provided:al2 as base
# DEST (destination) build arg to build for aws or local dev
ARG DEST
# Install the official AWS tools.
# Install Extra Packages for Enterprice Linux
RUN yum install -y amazon-linux-extras
RUN amazon-linux-extras install epel -y
# Update the package database
# To search for packages go to http://rpms.remirepo.net/
RUN rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
# Install PHP CLi and composer with the remi-php74 repo enabled
RUN yum --enablerepo=remi-php74 install -y \
php-cli-7.4.14 \
composer
# Install XDebug if DEST build arg is local
# Use bash conditional to prevent install on each build unless required
RUN if [[ "$DEST" == "local" ]] ; then \
yum --enablerepo=remi-php74 install -y \
php-xdebug ; \
fi
# Copy the bootstrap file to /var/runtime and grant it executable rights
COPY bootstrap /var/runtime
RUN chmod 755 /var/runtime/bootstrap
# Copy a php.ini override to /etc/php.d
COPY 99-prod-overrides.ini /etc/php.d
# Copy application code to /var/task
COPY handler.php composer.json /var/task/
COPY src /var/task/src
# Install dependencies via composer
# Use bash conditional to prevent install on each build unless
RUN composer install --no-ansi --no-dev --no-interaction --no-progress --prefer-dist --no-scripts --optimize-autoloader
# remove composer
RUN yum remove -y composer
# Tell the lambda what value to give the $_HANDLER env var.
CMD [ "handler.php" ]