Return to Tech/infra

For AWS Fargate

Dockerfile - simple Amazon Linux 2 - build as al2:latest
FROM amazonlinux:2

RUN yum update -y
build
docker build -t al2:latest .
Dockerfile - Customize 01: Amazon Linux 2 - build as al2:basephp7
FROM al2:latest

RUN yum install httpd -y
RUN amazon-linux-extras install epel -y
RUN rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
RUN rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
build
docker build -t al2:basephp7 .
Dockerfile - Customize 02: Amazon Linux 2 - build as al2:php7devenv
FROM al2:basephp7

RUN yum install ncurses-compat-libs git libedit libtool libxslt systemd-sysv gd-last -y
RUN yum install php --enablerepo=remi-php72 --disablerepo=amzn2-core -y
RUN yum install gcc gcc-c++ make automake zlib-devel openssl-devel libedit-devel krb5-devel libxml2-devel -y
RUN yum install php-devel php-gd phpunit php-pecl-xdebug --enablerepo=remi-php72 --disablerepo=amzn2-core -y
Customize 03: Amazon Linux 2 install mcrypt - build as al2:php7devenv
docker run -it -d --name installmcrypt al2:php7devenv /bin/bash
docker exec -it installmcrypt /bin/bash

bash-4.2# rpm -qa | grep mcrypt
libmcrypt-2.5.8-13.el7.x86_64
libmcrypt-devel-2.5.8-13.el7.x86_64
bash-4.2# rpm qa | grep php-pear 
php-pear-1.10.13-1.el7.remi.noarch

bash-4.2# pecl install mcrypt

...

Build process completed successfully
Installing '/usr/lib64/php/modules/mcrypt.so'
Install ok: channel://pecl.php.net/mcrypt-1.0.4
configuration option "php_ini" is not set to php.ini location
You should add "extension=mcrypt.so" to php.ini

base-4.2# grep ^extension /etc/php.ini
base-4.2# echo extension=mcrypt.so >> /etc/php.ini
base-4.2# grep ^extension /etc/php.ini
extension=mcrypt.so
bash-4.2# exit
exit

# docker commit installmcrypt al2:php7devenv

# docker images
REPOSITORY TAG         IMAGE ID       CREATED         SIZE
al2        php7devenv  0123456789AC   10 seconds ago  4.00 GB
al2        basephp7    0123456789AB   15 minutes ago  1.00 GB
al2        latest      0123456789AA   30 minutes ago   500 MB

# docker stop installmcrypt
# docker rm installmcrypt


Return to Tech/infra/docker
Return to Tech/infra