From 5a4a62475f9b728496599c814d9cce597867fed3 Mon Sep 17 00:00:00 2001 From: Aditya Prima Date: Fri, 1 Dec 2023 17:23:19 +0700 Subject: [PATCH] Updated dockerfile expose port --- Dockerfile_php56 | 2 +- Dockerfile_php72 | 22 ++++++++++++++++++---- Dockerfile_php73 | 24 ++++++++++++++++++------ Dockerfile_php74 | 28 +++++++++++++++++++++++----- Dockerfile_php8 | 21 ++++++++++++++++----- Dockerfile_php81 | 22 +++++++++++++++++----- Dockerfile_php82 | 18 +++++++++++++++--- etc/php7/php-fpm.conf | 6 +++--- 8 files changed, 111 insertions(+), 32 deletions(-) diff --git a/Dockerfile_php56 b/Dockerfile_php56 index 355f271..838de2f 100644 --- a/Dockerfile_php56 +++ b/Dockerfile_php56 @@ -27,4 +27,4 @@ RUN mkdir -p /var/run/php ADD ./etc/php5 /etc/php5 ADD ./etc/services.d/php-fpm5 /etc/services.d/php-fpm5 -EXPOSE 80 \ No newline at end of file +EXPOSE 9000 \ No newline at end of file diff --git a/Dockerfile_php72 b/Dockerfile_php72 index d2eb12b..ba591de 100644 --- a/Dockerfile_php72 +++ b/Dockerfile_php72 @@ -1,15 +1,18 @@ ARG ALPINE_VERSION=3.9 -FROM aprimediet/alpine:${ALPINE_VERSION} +FROM aprimediet/alpine:${ALPINE_VERSION} AS base LABEL maintainer=" aprimediet@gmail.com" +WORKDIR /root + # Add user and group www-data RUN addgroup -g 1010 www-data RUN adduser -u 1010 -D -H -h /usr/www -G www-data www-data RUN adduser www-data tty # INSTALL php7 -RUN apk add --update --no-cache \ +RUN --mount=type=cache,target=/var/cache/apk \ + apk add --update \ git php7 php7-bz2 php7-bcmath php7-common \ php7-ctype php7-curl php7-dev \ php7-dom php7-embed php7-exif php7-fileinfo \ @@ -17,7 +20,15 @@ RUN apk add --update --no-cache \ php7-iconv php7-intl php7-ldap php7-openssl php7-pear \ php7-pspell php7-session php7-simplexml php7-snmp php7-soap \ php7-sockets php7-tidy php7-tokenizer php7-xml php7-xmlreader \ - php7-xmlwriter php7-xsl php7-zip + php7-xmlwriter php7-xsl php7-zip php7-json php7-phar + +# Download composer +ADD https://getcomposer.org/installer ./composer-setup.php +RUN php composer-setup.php +RUN mv composer.phar /usr/local/bin/composer +RUN rm -f composer-setup.php + +FROM base AS build # COPY Configuration File RUN mkdir -p /var/run/php @@ -25,4 +36,7 @@ RUN mkdir -p /var/run/php ADD ./etc/php7 /etc/php7 ADD ./etc/services.d/php-fpm7 /etc/services.d/php-fpm7 -EXPOSE 80 \ No newline at end of file +# Clean APK Cache +RUN rm -rf /var/cache/apk/* + +EXPOSE 9000 \ No newline at end of file diff --git a/Dockerfile_php73 b/Dockerfile_php73 index a2fcca3..ca9b20c 100644 --- a/Dockerfile_php73 +++ b/Dockerfile_php73 @@ -1,16 +1,18 @@ ARG ALPINE_VERSION=3.10 -FROM aprimediet/alpine:${ALPINE_VERSION} +FROM aprimediet/alpine:${ALPINE_VERSION} AS base LABEL maintainer=" aprimediet@gmail.com" +WORKDIR /root + # Add user and group www-data RUN addgroup -g 1010 www-data RUN adduser -u 1010 -D -H -h /usr/www -G www-data www-data RUN adduser www-data tty -# INSTALL php5 -# RUN apk update && apk upgrade && \ -RUN apk add --update --no-cache \ +# INSTALL php7 +RUN --mount=type=cache,target=/var/cache/apk \ + apk add --update \ git php7 php7-bz2 php7-bcmath php7-common \ php7-ctype php7-curl php7-dev \ php7-dom php7-embed php7-exif php7-fileinfo \ @@ -18,7 +20,14 @@ RUN apk add --update --no-cache \ php7-iconv php7-intl php7-ldap php7-openssl php7-pear \ php7-pspell php7-session php7-simplexml php7-snmp php7-soap \ php7-sockets php7-tidy php7-tokenizer php7-xml php7-xmlreader \ - php7-xmlwriter php7-xsl php7-zip + php7-xmlwriter php7-xsl php7-zip php7-json php7-phar + +# Download composer +ADD https://getcomposer.org/installer ./composer-setup.php + +RUN php composer-setup.php && mv composer.phar /usr/local/bin/composer && rm -f composer-setup.php + +FROM base AS build # COPY Configuration File RUN mkdir -p /var/run/php @@ -26,4 +35,7 @@ RUN mkdir -p /var/run/php ADD ./etc/php7 /etc/php7 ADD ./etc/services.d/php-fpm7 /etc/services.d/php-fpm7 -EXPOSE 80 \ No newline at end of file +# Clean APK Cache +RUN rm -rf /var/cache/apk/* + +EXPOSE 9000 \ No newline at end of file diff --git a/Dockerfile_php74 b/Dockerfile_php74 index 456029e..29ae19d 100644 --- a/Dockerfile_php74 +++ b/Dockerfile_php74 @@ -1,10 +1,18 @@ ARG ALPINE_VERSION=3.13 -FROM aprimediet/alpine:${ALPINE_VERSION} +FROM aprimediet/alpine:${ALPINE_VERSION} AS base LABEL maintainer=" aprimediet@gmail.com" -# INSTALL php5 -RUN apk add --update --no-cache \ +WORKDIR /root + +# Add user and group www-data +RUN addgroup -g 1010 www-data +RUN adduser -u 1010 -D -H -h /usr/www -G www-data www-data +RUN adduser www-data tty + +# INSTALL php7 +RUN --mount=type=cache,target=/var/cache/apk \ + apk add --update \ git php7 php7-bz2 php7-bcmath php7-common \ php7-ctype php7-curl php7-dev \ php7-dom php7-embed php7-exif php7-fileinfo \ @@ -12,7 +20,14 @@ RUN apk add --update --no-cache \ php7-iconv php7-intl php7-ldap php7-openssl php7-pear \ php7-pspell php7-session php7-simplexml php7-snmp php7-soap \ php7-sockets php7-tidy php7-tokenizer php7-xml php7-xmlreader \ - php7-xmlwriter php7-xsl php7-zip + php7-xmlwriter php7-xsl php7-zip php7-json php7-phar + +# Download composer +ADD https://getcomposer.org/installer ./composer-setup.php + +RUN php composer-setup.php && mv composer.phar /usr/local/bin/composer && rm -f composer-setup.php + +FROM base AS build # COPY Configuration File RUN mkdir -p /var/run/php @@ -20,4 +35,7 @@ RUN mkdir -p /var/run/php ADD ./etc/php7 /etc/php7 ADD ./etc/services.d/php-fpm7 /etc/services.d/php-fpm7 -EXPOSE 80 \ No newline at end of file +# Clean APK Cache +RUN rm -rf /var/cache/apk/* + +EXPOSE 9000 \ No newline at end of file diff --git a/Dockerfile_php8 b/Dockerfile_php8 index d916010..70678b4 100644 --- a/Dockerfile_php8 +++ b/Dockerfile_php8 @@ -1,8 +1,10 @@ ARG ALPINE_VERSION=3.16 -FROM aprimediet/alpine:${ALPINE_VERSION} +FROM aprimediet/alpine:${ALPINE_VERSION} AS base LABEL maintainer=" aprimediet@gmail.com" +WORKDIR /root + # Add user and group www-data RUN mkdir /usr/www # RUN addgroup -g 1010 www-data @@ -10,8 +12,8 @@ RUN adduser -u 1010 -D -H -h /usr/www -G www-data www-data RUN adduser www-data tty # INSTALL php5 -# RUN apk update && apk upgrade && \ -RUN apk add --update --no-cache \ +RUN --mount=type=cache,target=/var/cache/apk \ + apk add --update \ git php8 php8-bz2 php8-bcmath php8-common \ php8-ctype php8-curl php8-dev \ php8-dom php8-embed php8-exif php8-fileinfo \ @@ -19,12 +21,21 @@ RUN apk add --update --no-cache \ php8-iconv php8-intl php8-ldap php8-openssl php8-pear \ php8-pspell php8-session php8-simplexml php8-snmp php8-soap \ php8-sockets php8-tidy php8-tokenizer php8-xml php8-xmlreader \ - php8-xmlwriter php8-xsl php8-zip php8-dbg php8-json + php8-xmlwriter php8-xsl php8-zip php8-dbg php8-json php8-phar + +# Download composer +ADD https://getcomposer.org/installer ./composer-setup.php +RUN php composer-setup.php && mv composer.phar /usr/local/bin/composer && rm -f composer-setup.php + +FROM base AS build # COPY Configuration File RUN mkdir -p /var/run/php ADD ./etc/php8 /etc/php8 -ADD ./etc/services.d/php-fpm82 /etc/services.d/php-fpm82 +ADD ./etc/services.d/php-fpm8 /etc/services.d/php-fpm8 + +# Clean APK Cache +RUN rm -rf /var/cache/apk/* EXPOSE 9000 \ No newline at end of file diff --git a/Dockerfile_php81 b/Dockerfile_php81 index 7719d2f..e0782a0 100644 --- a/Dockerfile_php81 +++ b/Dockerfile_php81 @@ -1,8 +1,10 @@ ARG ALPINE_VERSION=3.18 -FROM aprimediet/alpine:${ALPINE_VERSION} +FROM aprimediet/alpine:${ALPINE_VERSION} AS base LABEL maintainer=" aprimediet@gmail.com" +WORKDIR /root + # Add user and group www-data RUN mkdir /usr/www # RUN addgroup -g 1010 www-data @@ -10,8 +12,8 @@ RUN adduser -u 1010 -D -H -h /usr/www -G www-data www-data RUN adduser www-data tty # INSTALL php5 -# RUN apk update && apk upgrade && \ -RUN apk add --update --no-cache \ +RUN --mount=type=cache,target=/var/cache/apk \ + apk add --update \ git php81 php81-bz2 php81-bcmath php81-common \ php81-ctype php81-curl php81-dev \ php81-dom php81-embed php81-exif php81-fileinfo \ @@ -19,12 +21,22 @@ RUN apk add --update --no-cache \ php81-iconv php81-intl php81-ldap php81-openssl php81-pear \ php81-pspell php81-session php81-simplexml php81-snmp php81-soap \ php81-sockets php81-tidy php81-tokenizer php81-xml php81-xmlreader \ - php81-xmlwriter php81-xsl php81-zip php81-json + php81-xmlwriter php81-xsl php81-zip php81-json php81-phar + +# Download composer +ADD https://getcomposer.org/installer ./composer-setup.php + +RUN php81 composer-setup.php && mv composer.phar /usr/local/bin/composer && rm -f composer-setup.php + +FROM base AS build # COPY Configuration File RUN mkdir -p /var/run/php ADD ./etc/php81 /etc/php81 -ADD ./etc/services.d/php-fpm82 /etc/services.d/php-fpm82 +ADD ./etc/services.d/php-fpm81 /etc/services.d/php-fpm81 + +# Clean APK Cache +RUN rm -rf /var/cache/apk/* EXPOSE 9000 \ No newline at end of file diff --git a/Dockerfile_php82 b/Dockerfile_php82 index 3ad128f..c5fdf46 100644 --- a/Dockerfile_php82 +++ b/Dockerfile_php82 @@ -1,8 +1,10 @@ ARG ALPINE_VERSION=3.18 -FROM aprimediet/alpine:${ALPINE_VERSION} +FROM aprimediet/alpine:${ALPINE_VERSION} AS base LABEL maintainer=" aprimediet@gmail.com" +WORKDIR /root + # Add user and group www-data RUN mkdir /usr/www # RUN addgroup -g 1010 www-data @@ -11,7 +13,8 @@ RUN adduser www-data tty # INSTALL php5 # RUN apk update && apk upgrade && \ -RUN apk add --update --no-cache \ +RUN --mount=type=cache,target=/var/cache/apk \ + apk add --update \ git php82 php82-bz2 php82-bcmath php82-common \ php82-ctype php82-curl php82-dev \ php82-dom php82-embed php82-exif php82-fileinfo \ @@ -19,7 +22,13 @@ RUN apk add --update --no-cache \ php82-iconv php82-intl php82-ldap php82-openssl php82-pear \ php82-pspell php82-session php82-simplexml php82-snmp php82-soap \ php82-sockets php82-tidy php82-tokenizer php82-xml php82-xmlreader \ - php82-xmlwriter php82-xsl php82-zip php82-dbg php82-json + php82-xmlwriter php82-xsl php82-zip php82-dbg php82-json php82-phar + +# Download composer +ADD https://getcomposer.org/installer ./composer-setup.php +RUN php82 composer-setup.php && mv composer.phar /usr/local/bin/composer && rm -f composer-setup.php + +FROM base AS build # COPY Configuration File RUN mkdir -p /var/run/php @@ -27,4 +36,7 @@ RUN mkdir -p /var/run/php ADD ./etc/php82 /etc/php82 ADD ./etc/services.d/php-fpm82 /etc/services.d/php-fpm82 +# Clean APK Cache +RUN rm -rf /var/apk/cache/* + EXPOSE 9000 \ No newline at end of file diff --git a/etc/php7/php-fpm.conf b/etc/php7/php-fpm.conf index 6f3102d..da11684 100644 --- a/etc/php7/php-fpm.conf +++ b/etc/php7/php-fpm.conf @@ -20,8 +20,8 @@ ; If it's set to "syslog", log is sent to syslogd instead of being written ; into a local file. ; Note: the default prefix is /var -; Default Value: log/php5/error.log -;error_log = log/php5/error.log +; Default Value: log/php7/error.log +;error_log = log/php7/error.log error_log = /proc/self/fd/2 ; syslog_facility is used to specify what type of program is logging the @@ -172,4 +172,4 @@ process_control_timeout = 10s ; Relative path can also be used. They will be prefixed by: ; - the global prefix if it's been set (-p argument) ; - /usr otherwise -include=/etc/php5/php-fpm.d/*.conf \ No newline at end of file +include=/etc/php7/php-fpm.d/*.conf \ No newline at end of file