Commit 9d57dd35 authored by caiyanming's avatar caiyanming

add php

Change-Id: I50251536b56e617ed168f67a249635e30d5e65c2
parent bac4ace8
FROM bitnami/php-fpm:7.3.11-debian-9-r14 as development
######
FROM bitnami/minideb:stretch
LABEL maintainer "Bitnami <containers@bitnami.com>"
COPY sources.list /etc/apt/sources.list
# Install required system packages and dependencies
RUN install_packages ca-certificates libbz2-1.0 libc6 libcomerr2 libcurl3 libffi6 libfreetype6 libgcc1 libgcrypt20 libgmp10 libgnutls30 libgpg-error0 libgssapi-krb5-2 libhogweed4 libicu57 libidn11 libidn2-0 libjpeg62-turbo libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2 liblzma5 libmemcached11 libmemcachedutil2 libncurses5 libnettle6 libnghttp2-14 libp11-kit0 libpng16-16 libpq5 libpsl5 libreadline7 librtmp1 libsasl2-2 libssh2-1 libssl1.0.2 libssl1.1 libstdc++6 libsybdb5 libtasn1-6 libtidy5 libtinfo5 libunistring0 libxml2 libxslt1.1 libzip4 zlib1g
RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \
sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \
sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password
COPY --from=development /opt/bitnami/common /opt/bitnami/common
COPY --from=development /opt/bitnami/php /opt/bitnami/php
ENV BITNAMI_APP_NAME="php-fpm" \
BITNAMI_IMAGE_VERSION="7.3.11-debian-9-r14-prod" \
PATH="/opt/bitnami/php/bin:/opt/bitnami/php/sbin:/opt/bitnami/php/sbin:$PATH"
CMD [ "php-fpm", "-F", "--pid", "/opt/bitnami/php/tmp/php-fpm.pid", "-y", "/opt/bitnami/php/etc/php-fpm.conf" ]
<!--
If you are reporting a new issue, make sure that we do not have any duplicates
already open. You can ensure this by searching the issue list for this
repository. If there is a duplicate, please close your issue and add a comment
to the existing issue instead.
If you suspect your issue is a bug, please edit your issue description to
include the BUG REPORT INFORMATION shown below. If you fail to provide this
information within 7 days, we cannot debug your issue and we'll close it. We
will, however, reopen it if you later provide the information.
-------------------------------
BUG REPORT INFORMATION
-------------------------------
Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST
-->
**Description**
<!-- Briefly describe the problem you are having in a few paragraphs. -->
**Steps to reproduce the issue:**
1. [First Step]
2. [Second Step]
3. [and so on...]
**Describe the results you received:**
<!-- What actually happens -->
**Describe the results you expected:**
<!-- What you expect to happen -->
**Additional information you deem important (e.g. issue happens only occasionally):**
<!-- Any additional information, configuration or data that might be necessary to reproduce the issue. -->
**Version**
- Output of `docker version`:
```
(paste your output here)
```
- Output of `docker info`:
```
(paste your output here)
```
- Output of `docker-compose version` (if applicable):
```
(paste your output here)
```
**Additional environment details (AWS, VirtualBox, Docker for MAC, physical, etc.):**
<!--
Before you open the request please review the following guidelines and tips to help it be more easily integrated:
- Describe the scope of your change - i.e. what the change does.
- Describe any known limitations with your change.
- Please run any tests or examples that can exercise your modified code.
Thank you for contributing! We will try to test and integrate the change as soon as we can, but be aware we have many GitHub repositories to manage and can't immediately respond to every request. There is no need to bump or check in on a pull request (it will clutter the discussion of the request).
Also don't be worried if the request is closed or not integrated sometimes the priorities of Bitnami might not match the priorities of the pull request. Don't fret, the open source community thrives on forks and GitHub makes it easy to keep your changes in a forked repo.
-->
**Description of the change**
<!-- Describe the scope of your change - i.e. what the change does. -->
**Benefits**
<!-- What benefits will be realized by the code change? -->
**Possible drawbacks**
<!-- Describe any known limitations with your change -->
**Applicable issues**
<!-- Enter any applicable Issues here (You can reference an issue using #) -->
**Additional information**
<!-- If there's anything else that's important and relevant to your pull
request, mention that information here.-->
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 15
# Number of days of inactivity before a stale Issue or Pull Request is closed.
daysUntilClose: 5
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- on-hold
# Label to use when marking as stale
staleLabel: stale
issues:
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.
# Comment to post when closing a stale Issue or Pull Request.
closeComment: >
Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.
pulls:
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This Pull Request has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thank you for your contribution.
# Comment to post when closing a stale Issue or Pull Request.
closeComment: >
Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Pull Request. Do not hesitate to reopen it later if necessary.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30
FROM bitnami/php-fpm:7.1.33-debian-9-r14 as development
######
FROM bitnami/minideb:stretch
LABEL maintainer "Bitnami <containers@bitnami.com>"
# Install required system packages and dependencies
RUN install_packages ca-certificates libbz2-1.0 libc6 libcomerr2 libcurl3 libffi6 libfreetype6 libgcc1 libgcrypt20 libgmp10 libgnutls30 libgpg-error0 libgssapi-krb5-2 libhogweed4 libicu57 libidn11 libidn2-0 libjpeg62-turbo libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2 liblzma5 libmcrypt4 libmemcached11 libmemcachedutil2 libncurses5 libnettle6 libnghttp2-14 libp11-kit0 libpng16-16 libpq5 libpsl5 libreadline7 librtmp1 libsasl2-2 libssh2-1 libssl1.0.2 libssl1.1 libstdc++6 libsybdb5 libtasn1-6 libtidy5 libtinfo5 libunistring0 libxml2 libxslt1.1 zlib1g
RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \
sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \
sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password
COPY --from=development /opt/bitnami/common /opt/bitnami/common
COPY --from=development /opt/bitnami/php /opt/bitnami/php
ENV BITNAMI_APP_NAME="php-fpm" \
BITNAMI_IMAGE_VERSION="7.1.33-debian-9-r13-prod" \
PATH="/opt/bitnami/php/bin:/opt/bitnami/php/sbin:/opt/bitnami/php/sbin:$PATH"
CMD [ "php-fpm", "-F", "--pid", "/opt/bitnami/php/tmp/php-fpm.pid", "-y", "/opt/bitnami/php/etc/php-fpm.conf" ]
version: '2'
services:
php:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/php-fpm:7.1-prod'
ports:
- 9000:9000
volumes:
- .:/app
FROM bitnami/php-fpm:7.1.33-ol-7-r20 as development
######
FROM bitnami/oraclelinux-runtimes:7-r497
LABEL maintainer "Bitnami <containers@bitnami.com>"
# Install required system packages and dependencies
RUN install_packages bzip2-libs ca-certificates cyrus-sasl-lib freetds-libs freetype glibc gmp gnutls keyutils-libs krb5-libs libcom_err libcurl libffi libgcc libgcrypt libgpg-error libicu libidn libjpeg-turbo libmcrypt libmemcached libpng libselinux libssh2 libstdc++ libtasn1 libtidy libxml2 libxslt ncurses-libs nettle nspr nss nss-softokn-freebl nss-util openldap openssl-libs p11-kit pcre postgresql-libs readline wget xz-libs zlib
COPY --from=development /opt/bitnami/common /opt/bitnami/common
COPY --from=development /opt/bitnami/php /opt/bitnami/php
ENV BITNAMI_APP_NAME="php-fpm" \
BITNAMI_IMAGE_VERSION="7.1.33-ol-7-r19-prod" \
PATH="/opt/bitnami/php/bin:/opt/bitnami/php/sbin:/opt/bitnami/php/sbin:$PATH"
CMD [ "php-fpm", "-F", "--pid", "/opt/bitnami/php/tmp/php-fpm.pid", "-y", "/opt/bitnami/php/etc/php-fpm.conf" ]
version: '2'
services:
php:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/php-fpm:7.1-ol-7-prod'
ports:
- 9000:9000
volumes:
- .:/app
FROM bitnami/minideb:stretch
LABEL maintainer "Bitnami <containers@bitnami.com>"
# Install required system packages and dependencies
RUN install_packages ca-certificates libbz2-1.0 libc6 libcomerr2 libcurl3 libffi6 libfreetype6 libgcc1 libgcrypt20 libgmp10 libgnutls30 libgpg-error0 libgssapi-krb5-2 libhogweed4 libicu57 libidn11 libidn2-0 libjpeg62-turbo libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2 liblzma5 libmcrypt4 libmemcached11 libmemcachedutil2 libncurses5 libnettle6 libnghttp2-14 libp11-kit0 libpng16-16 libpq5 libpsl5 libreadline7 librtmp1 libsasl2-2 libsqlite3-dev libssh2-1 libssl-dev libssl1.0.2 libssl1.1 libstdc++6 libsybdb5 libtasn1-6 libtidy5 libtinfo5 libunistring0 libxml2 libxslt1.1 wget zlib1g
RUN wget -nc -P /tmp/bitnami/pkg/cache/ https://downloads.bitnami.com/files/stacksmith/php-7.1.33-0-linux-amd64-debian-9.tar.gz && \
echo "35877d3ecf16f24b91403fd9fbe94a3d6a9715c5cb0d2dc5f29f505621e80d7e /tmp/bitnami/pkg/cache/php-7.1.33-0-linux-amd64-debian-9.tar.gz" | sha256sum -c - && \
tar -zxf /tmp/bitnami/pkg/cache/php-7.1.33-0-linux-amd64-debian-9.tar.gz -P --transform 's|^[^/]*/files|/opt/bitnami|' --wildcards '*/files' && \
rm -rf /tmp/bitnami/pkg/cache/php-7.1.33-0-linux-amd64-debian-9.tar.gz
RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \
sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \
sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password
ENV BITNAMI_APP_NAME="php-fpm" \
BITNAMI_IMAGE_VERSION="7.1.33-debian-9-r14" \
PATH="/opt/bitnami/php/bin:/opt/bitnami/php/sbin:$PATH"
EXPOSE 9000
WORKDIR /app
CMD [ "php-fpm", "-F", "--pid", "/opt/bitnami/php/tmp/php-fpm.pid", "-y", "/opt/bitnami/php/etc/php-fpm.conf" ]
version: '2'
services:
php:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/php-fpm:7.1'
ports:
- 9000:9000
volumes:
- .:/app
FROM bitnami/oraclelinux-runtimes:7-r497
LABEL maintainer "Bitnami <containers@bitnami.com>"
# Install required system packages and dependencies
RUN install_packages bzip2-libs ca-certificates cyrus-sasl-lib freetds-libs freetype glibc gmp gnutls keyutils-libs krb5-libs libcom_err libcurl libffi libgcc libgcrypt libgpg-error libicu libidn libjpeg-turbo libmcrypt libmemcached libpng libselinux libssh2 libstdc++ libtasn1 libtidy libxml2 libxslt ncurses-libs nettle nspr nss nss-softokn-freebl nss-util openldap openssl-libs p11-kit pcre postgresql-libs readline wget xz-libs zlib
RUN wget -nc -P /tmp/bitnami/pkg/cache/ https://downloads.bitnami.com/files/stacksmith/php-7.1.33-0-linux-x86_64-ol-7.tar.gz && \
echo "f0d4060d152165ce210c3433b2fe98a9462fb5a5c64a855228986c217667c93c /tmp/bitnami/pkg/cache/php-7.1.33-0-linux-x86_64-ol-7.tar.gz" | sha256sum -c - && \
tar -zxf /tmp/bitnami/pkg/cache/php-7.1.33-0-linux-x86_64-ol-7.tar.gz -P --transform 's|^[^/]*/files|/opt/bitnami|' --wildcards '*/files' && \
rm -rf /tmp/bitnami/pkg/cache/php-7.1.33-0-linux-x86_64-ol-7.tar.gz
ENV BITNAMI_APP_NAME="php-fpm" \
BITNAMI_IMAGE_VERSION="7.1.33-ol-7-r20" \
PATH="/opt/bitnami/php/bin:/opt/bitnami/php/sbin:$PATH"
EXPOSE 9000
WORKDIR /app
CMD [ "php-fpm", "-F", "--pid", "/opt/bitnami/php/tmp/php-fpm.pid", "-y", "/opt/bitnami/php/etc/php-fpm.conf" ]
version: '2'
services:
php:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/php-fpm:7.1-ol-7'
ports:
- 9000:9000
volumes:
- .:/app
FROM bitnami/php-fpm:7.2.24-debian-9-r14 as development
######
FROM bitnami/minideb:stretch
LABEL maintainer "Bitnami <containers@bitnami.com>"
# Install required system packages and dependencies
RUN install_packages ca-certificates libbz2-1.0 libc6 libcomerr2 libcurl3 libffi6 libfreetype6 libgcc1 libgcrypt20 libgmp10 libgnutls30 libgpg-error0 libgssapi-krb5-2 libhogweed4 libicu57 libidn11 libidn2-0 libjpeg62-turbo libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2 liblzma5 libmemcached11 libmemcachedutil2 libncurses5 libnettle6 libnghttp2-14 libp11-kit0 libpng16-16 libpq5 libpsl5 libreadline7 librtmp1 libsasl2-2 libssh2-1 libssl1.0.2 libssl1.1 libstdc++6 libsybdb5 libtasn1-6 libtidy5 libtinfo5 libunistring0 libxml2 libxslt1.1 zlib1g
RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \
sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \
sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password
COPY --from=development /opt/bitnami/common /opt/bitnami/common
COPY --from=development /opt/bitnami/php /opt/bitnami/php
ENV BITNAMI_APP_NAME="php-fpm" \
BITNAMI_IMAGE_VERSION="7.2.24-debian-9-r14-prod" \
PATH="/opt/bitnami/php/bin:/opt/bitnami/php/sbin:/opt/bitnami/php/sbin:$PATH"
CMD [ "php-fpm", "-F", "--pid", "/opt/bitnami/php/tmp/php-fpm.pid", "-y", "/opt/bitnami/php/etc/php-fpm.conf" ]
version: '2'
services:
php:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/php-fpm:7.2-prod'
ports:
- 9000:9000
volumes:
- .:/app
FROM bitnami/php-fpm:7.2.24-ol-7-r19 as development
######
FROM bitnami/oraclelinux-runtimes:7-r497
LABEL maintainer "Bitnami <containers@bitnami.com>"
# Install required system packages and dependencies
RUN install_packages bzip2-libs ca-certificates cyrus-sasl-lib freetds-libs freetype glibc gmp gnutls keyutils-libs krb5-libs libcom_err libcurl libffi libgcc libgcrypt libgpg-error libicu libidn libjpeg-turbo libmemcached libpng libselinux libssh2 libstdc++ libtasn1 libtidy libxml2 libxslt ncurses-libs nettle nspr nss nss-softokn-freebl nss-util openldap openssl-libs p11-kit pcre postgresql-libs readline wget xz-libs zlib
COPY --from=development /opt/bitnami/common /opt/bitnami/common
COPY --from=development /opt/bitnami/php /opt/bitnami/php
ENV BITNAMI_APP_NAME="php-fpm" \
BITNAMI_IMAGE_VERSION="7.2.24-ol-7-r19-prod" \
PATH="/opt/bitnami/php/bin:/opt/bitnami/php/sbin:/opt/bitnami/php/sbin:$PATH"
CMD [ "php-fpm", "-F", "--pid", "/opt/bitnami/php/tmp/php-fpm.pid", "-y", "/opt/bitnami/php/etc/php-fpm.conf" ]
version: '2'
services:
php:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/php-fpm:7.2-ol-7-prod'
ports:
- 9000:9000
volumes:
- .:/app
FROM bitnami/minideb:stretch
LABEL maintainer "Bitnami <containers@bitnami.com>"
# Install required system packages and dependencies
RUN install_packages ca-certificates libbz2-1.0 libc6 libcomerr2 libcurl3 libffi6 libfreetype6 libgcc1 libgcrypt20 libgmp10 libgnutls30 libgpg-error0 libgssapi-krb5-2 libhogweed4 libicu57 libidn11 libidn2-0 libjpeg62-turbo libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2 liblzma5 libmemcached11 libmemcachedutil2 libncurses5 libnettle6 libnghttp2-14 libp11-kit0 libpng16-16 libpq5 libpsl5 libreadline7 librtmp1 libsasl2-2 libsqlite3-dev libssh2-1 libssl-dev libssl1.0.2 libssl1.1 libstdc++6 libsybdb5 libtasn1-6 libtidy5 libtinfo5 libunistring0 libxml2 libxslt1.1 wget zlib1g
RUN wget -nc -P /tmp/bitnami/pkg/cache/ https://downloads.bitnami.com/files/stacksmith/php-7.2.24-0-linux-amd64-debian-9.tar.gz && \
echo "1b07c4047c4091aea0dbf93a36a7cbcedb84c6a57e65035fde48fa7ef7daafd3 /tmp/bitnami/pkg/cache/php-7.2.24-0-linux-amd64-debian-9.tar.gz" | sha256sum -c - && \
tar -zxf /tmp/bitnami/pkg/cache/php-7.2.24-0-linux-amd64-debian-9.tar.gz -P --transform 's|^[^/]*/files|/opt/bitnami|' --wildcards '*/files' && \
rm -rf /tmp/bitnami/pkg/cache/php-7.2.24-0-linux-amd64-debian-9.tar.gz
RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \
sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \
sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password
ENV BITNAMI_APP_NAME="php-fpm" \
BITNAMI_IMAGE_VERSION="7.2.24-debian-9-r14" \
PATH="/opt/bitnami/php/bin:/opt/bitnami/php/sbin:$PATH"
EXPOSE 9000
WORKDIR /app
CMD [ "php-fpm", "-F", "--pid", "/opt/bitnami/php/tmp/php-fpm.pid", "-y", "/opt/bitnami/php/etc/php-fpm.conf" ]
version: '2'
services:
php:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/php-fpm:7.2'
ports:
- 9000:9000
volumes:
- .:/app
FROM bitnami/oraclelinux-runtimes:7-r497
LABEL maintainer "Bitnami <containers@bitnami.com>"
# Install required system packages and dependencies
RUN install_packages bzip2-libs ca-certificates cyrus-sasl-lib freetds-libs freetype glibc gmp gnutls keyutils-libs krb5-libs libcom_err libcurl libffi libgcc libgcrypt libgpg-error libicu libidn libjpeg-turbo libmemcached libpng libselinux libssh2 libstdc++ libtasn1 libtidy libxml2 libxslt ncurses-libs nettle nspr nss nss-softokn-freebl nss-util openldap openssl-libs p11-kit pcre postgresql-libs readline wget xz-libs zlib
RUN wget -nc -P /tmp/bitnami/pkg/cache/ https://downloads.bitnami.com/files/stacksmith/php-7.2.24-0-linux-x86_64-ol-7.tar.gz && \
echo "03e0363d640044e2810d88267bd345a51214d0d38a6bed9d00f0150f31856267 /tmp/bitnami/pkg/cache/php-7.2.24-0-linux-x86_64-ol-7.tar.gz" | sha256sum -c - && \
tar -zxf /tmp/bitnami/pkg/cache/php-7.2.24-0-linux-x86_64-ol-7.tar.gz -P --transform 's|^[^/]*/files|/opt/bitnami|' --wildcards '*/files' && \
rm -rf /tmp/bitnami/pkg/cache/php-7.2.24-0-linux-x86_64-ol-7.tar.gz
ENV BITNAMI_APP_NAME="php-fpm" \
BITNAMI_IMAGE_VERSION="7.2.24-ol-7-r19" \
PATH="/opt/bitnami/php/bin:/opt/bitnami/php/sbin:$PATH"
EXPOSE 9000
WORKDIR /app
CMD [ "php-fpm", "-F", "--pid", "/opt/bitnami/php/tmp/php-fpm.pid", "-y", "/opt/bitnami/php/etc/php-fpm.conf" ]
version: '2'
services:
php:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/php-fpm:7.2-ol-7'
ports:
- 9000:9000
volumes:
- .:/app
FROM bitnami/php-fpm:7.3.11-debian-9-r14 as development
######
FROM bitnami/minideb:stretch
LABEL maintainer "Bitnami <containers@bitnami.com>"
# Install required system packages and dependencies
RUN install_packages ca-certificates libbz2-1.0 libc6 libcomerr2 libcurl3 libffi6 libfreetype6 libgcc1 libgcrypt20 libgmp10 libgnutls30 libgpg-error0 libgssapi-krb5-2 libhogweed4 libicu57 libidn11 libidn2-0 libjpeg62-turbo libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2 liblzma5 libmemcached11 libmemcachedutil2 libncurses5 libnettle6 libnghttp2-14 libp11-kit0 libpng16-16 libpq5 libpsl5 libreadline7 librtmp1 libsasl2-2 libssh2-1 libssl1.0.2 libssl1.1 libstdc++6 libsybdb5 libtasn1-6 libtidy5 libtinfo5 libunistring0 libxml2 libxslt1.1 libzip4 zlib1g
RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \
sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \
sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password
COPY --from=development /opt/bitnami/common /opt/bitnami/common
COPY --from=development /opt/bitnami/php /opt/bitnami/php
ENV BITNAMI_APP_NAME="php-fpm" \
BITNAMI_IMAGE_VERSION="7.3.11-debian-9-r14-prod" \
PATH="/opt/bitnami/php/bin:/opt/bitnami/php/sbin:/opt/bitnami/php/sbin:$PATH"
CMD [ "php-fpm", "-F", "--pid", "/opt/bitnami/php/tmp/php-fpm.pid", "-y", "/opt/bitnami/php/etc/php-fpm.conf" ]
version: '2'
services:
php:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/php-fpm:7.3-prod'
ports:
- 9000:9000
volumes:
- .:/app
FROM bitnami/php-fpm:7.3.11-ol-7-r19 as development
######
FROM bitnami/oraclelinux-runtimes:7-r497
LABEL maintainer "Bitnami <containers@bitnami.com>"
# Install required system packages and dependencies
RUN install_packages bzip2-libs ca-certificates cyrus-sasl-lib freetds-libs freetype glibc gmp gnutls keyutils-libs krb5-libs libcom_err libcurl libffi libgcc libgcrypt libgpg-error libicu libidn libjpeg-turbo libmemcached libpng libselinux libssh2 libstdc++ libtasn1 libtidy libxml2 libxslt ncurses-libs nettle nspr nss nss-softokn-freebl nss-util openldap openssl-libs p11-kit pcre postgresql-libs readline wget xz-libs zlib
COPY --from=development /opt/bitnami/common /opt/bitnami/common
COPY --from=development /opt/bitnami/php /opt/bitnami/php
ENV BITNAMI_APP_NAME="php-fpm" \
BITNAMI_IMAGE_VERSION="7.3.11-ol-7-r19-prod" \
PATH="/opt/bitnami/php/bin:/opt/bitnami/php/sbin:/opt/bitnami/php/sbin:$PATH"
CMD [ "php-fpm", "-F", "--pid", "/opt/bitnami/php/tmp/php-fpm.pid", "-y", "/opt/bitnami/php/etc/php-fpm.conf" ]
version: '2'
services:
php:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/php-fpm:7.3-ol-7-prod'
ports:
- 9000:9000
volumes:
- .:/app
FROM bitnami/minideb:stretch
LABEL maintainer "Bitnami <containers@bitnami.com>"
# Install required system packages and dependencies
RUN install_packages ca-certificates libbz2-1.0 libc6 libcomerr2 libcurl3 libffi6 libfreetype6 libgcc1 libgcrypt20 libgmp10 libgnutls30 libgpg-error0 libgssapi-krb5-2 libhogweed4 libicu57 libidn11 libidn2-0 libjpeg62-turbo libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2 liblzma5 libmemcached11 libmemcachedutil2 libncurses5 libnettle6 libnghttp2-14 libp11-kit0 libpng16-16 libpq5 libpsl5 libreadline7 librtmp1 libsasl2-2 libsqlite3-dev libssh2-1 libssl-dev libssl1.0.2 libssl1.1 libstdc++6 libsybdb5 libtasn1-6 libtidy5 libtinfo5 libunistring0 libxml2 libxslt1.1 libzip4 wget zlib1g
RUN wget -nc -P /tmp/bitnami/pkg/cache/ https://downloads.bitnami.com/files/stacksmith/php-7.3.11-0-linux-amd64-debian-9.tar.gz && \
echo "65d3eb32f36d3017a4d729670cf0362108335e8af19f82ae4d6283db4cf4a73f /tmp/bitnami/pkg/cache/php-7.3.11-0-linux-amd64-debian-9.tar.gz" | sha256sum -c - && \
tar -zxf /tmp/bitnami/pkg/cache/php-7.3.11-0-linux-amd64-debian-9.tar.gz -P --transform 's|^[^/]*/files|/opt/bitnami|' --wildcards '*/files' && \
rm -rf /tmp/bitnami/pkg/cache/php-7.3.11-0-linux-amd64-debian-9.tar.gz
RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \
sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \
sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password
ENV BITNAMI_APP_NAME="php-fpm" \
BITNAMI_IMAGE_VERSION="7.3.11-debian-9-r14" \
PATH="/opt/bitnami/php/bin:/opt/bitnami/php/sbin:$PATH"
EXPOSE 9000
WORKDIR /app
CMD [ "php-fpm", "-F", "--pid", "/opt/bitnami/php/tmp/php-fpm.pid", "-y", "/opt/bitnami/php/etc/php-fpm.conf" ]
version: '2'
services:
php:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/php-fpm:7.3'
ports:
- 9000:9000
volumes:
- .:/app
FROM bitnami/oraclelinux-runtimes:7-r497
LABEL maintainer "Bitnami <containers@bitnami.com>"
# Install required system packages and dependencies
RUN install_packages bzip2-libs ca-certificates cyrus-sasl-lib freetds-libs freetype glibc gmp gnutls keyutils-libs krb5-libs libcom_err libcurl libffi libgcc libgcrypt libgpg-error libicu libidn libjpeg-turbo libmemcached libpng libselinux libssh2 libstdc++ libtasn1 libtidy libxml2 libxslt ncurses-libs nettle nspr nss nss-softokn-freebl nss-util openldap openssl-libs p11-kit pcre postgresql-libs readline wget xz-libs zlib
RUN wget -nc -P /tmp/bitnami/pkg/cache/ https://downloads.bitnami.com/files/stacksmith/php-7.3.11-0-linux-x86_64-ol-7.tar.gz && \
echo "88001699b01c3677a29c36a865db155d36d7cac6df0173934d43b952b3e0714a /tmp/bitnami/pkg/cache/php-7.3.11-0-linux-x86_64-ol-7.tar.gz" | sha256sum -c - && \
tar -zxf /tmp/bitnami/pkg/cache/php-7.3.11-0-linux-x86_64-ol-7.tar.gz -P --transform 's|^[^/]*/files|/opt/bitnami|' --wildcards '*/files' && \
rm -rf /tmp/bitnami/pkg/cache/php-7.3.11-0-linux-x86_64-ol-7.tar.gz
ENV BITNAMI_APP_NAME="php-fpm" \
BITNAMI_IMAGE_VERSION="7.3.11-ol-7-r19" \
PATH="/opt/bitnami/php/bin:/opt/bitnami/php/sbin:$PATH"
EXPOSE 9000
WORKDIR /app
CMD [ "php-fpm", "-F", "--pid", "/opt/bitnami/php/tmp/php-fpm.pid", "-y", "/opt/bitnami/php/etc/php-fpm.conf" ]
version: '2'
services:
php:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/php-fpm:7.3-ol-7'
ports:
- 9000:9000
volumes:
- .:/app
Copyright (c) 2015-2018 Bitnami
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# What is PHP-FPM?
> PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites.
[php-fpm.org](http://php-fpm.org/)
# TL;DR;
```bash
$ docker run -it --name phpfpm -v /path/to/app:/app bitnami/php-fpm
```
## Docker Compose
```bash
$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-php-fpm/master/docker-compose.yml > docker-compose.yml
$ docker-compose up -d
```
# Why use Bitnami Images?
* Bitnami closely tracks upstream source changes and promptly publishes new versions of this image using our automated systems.
* With Bitnami images the latest bug fixes and features are available as soon as possible.
* Bitnami containers, virtual machines and cloud images use the same components and configuration approach - making it easy to switch between formats based on your project needs.
* All our images are based on [minideb](https://github.com/bitnami/minideb) a minimalist Debian based container image which gives you a small base container image and the familiarity of a leading linux distribution.
* All Bitnami images available in Docker Hub are signed with [Docker Content Trust (DTC)](https://docs.docker.com/engine/security/trust/content_trust/). You can use `DOCKER_CONTENT_TRUST=1` to verify the integrity of the images.
* Bitnami container images are released daily with the latest distribution packages available.
> This [CVE scan report](https://quay.io/repository/bitnami/php-fpm?tab=tags) contains a security report with all open CVEs. To get the list of actionable security issues, find the "latest" tag, click the vulnerability report link under the corresponding "Security scan" field and then select the "Only show fixable" filter on the next page.
# How to deploy PHP-FPM in Kubernetes?
You can find an example for testing in the file `test.yaml`. To launch this sample file run:
```bash
$ kubectl apply -f test.yaml
```
> NOTE: If you are pulling from a private containers registry, replace the image name with the full URL to the docker image. E.g.
>
> - image: 'your-registry/image-name:your-version'
# Supported tags and respective `Dockerfile` links
> NOTE: Debian 8 images have been deprecated in favor of Debian 9 images. Bitnami will not longer publish new Docker images based on Debian 8.
Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/).
* [`7.3-ol-7-prod`, `7.3.11-ol-7-r19-prod` (7.3-prod/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-php-fpm/blob/7.3.11-ol-7-r19-prod/7.3-prod/ol-7/Dockerfile)
* [`7.3-ol-7`, `7.3.11-ol-7-r19` (7.3/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-php-fpm/blob/7.3.11-ol-7-r19/7.3/ol-7/Dockerfile)
* [`7.3-debian-9-prod`, `7.3.11-debian-9-r14-prod`, `7.3-prod`, `7.3.11-prod`, `7.3.11-r14-prod`, `latest-prod` (7.3-prod/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-php-fpm/blob/7.3.11-debian-9-r14-prod/7.3-prod/debian-9/Dockerfile)
* [`7.3-debian-9`, `7.3.11-debian-9-r14`, `7.3`, `7.3.11`, `7.3.11-r14`, `latest` (7.3/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-php-fpm/blob/7.3.11-debian-9-r14/7.3/debian-9/Dockerfile)
* [`7.2-ol-7-prod`, `7.2.24-ol-7-r19-prod` (7.2-prod/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-php-fpm/blob/7.2.24-ol-7-r19-prod/7.2-prod/ol-7/Dockerfile)
* [`7.2-ol-7`, `7.2.24-ol-7-r19` (7.2/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-php-fpm/blob/7.2.24-ol-7-r19/7.2/ol-7/Dockerfile)
* [`7.2-debian-9-prod`, `7.2.24-debian-9-r14-prod`, `7.2-prod`, `7.2.24-prod`, `7.2.24-r14-prod` (7.2-prod/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-php-fpm/blob/7.2.24-debian-9-r14-prod/7.2-prod/debian-9/Dockerfile)
* [`7.2-debian-9`, `7.2.24-debian-9-r14`, `7.2`, `7.2.24`, `7.2.24-r14` (7.2/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-php-fpm/blob/7.2.24-debian-9-r14/7.2/debian-9/Dockerfile)
* [`7.1-ol-7`, `7.1.33-ol-7-r20` (7.1/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-php-fpm/blob/7.1.33-ol-7-r20/7.1/ol-7/Dockerfile)
* [`7.1-ol-7-prod`, `7.1.33-ol-7-r19-prod` (7.1-prod/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-php-fpm/blob/7.1.33-ol-7-r19-prod/7.1-prod/ol-7/Dockerfile)
* [`7.1-debian-9`, `7.1.33-debian-9-r14`, `7.1`, `7.1.33`, `7.1.33-r14` (7.1/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-php-fpm/blob/7.1.33-debian-9-r14/7.1/debian-9/Dockerfile)
* [`7.1-debian-9-prod`, `7.1.33-debian-9-r13-prod`, `7.1-prod`, `7.1.33-prod`, `7.1.33-r13-prod` (7.1-prod/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-php-fpm/blob/7.1.33-debian-9-r13-prod/7.1-prod/debian-9/Dockerfile)
Subscribe to project updates by watching the [bitnami/php-fpm GitHub repo](https://github.com/bitnami/bitnami-docker-php-fpm).
# What are `prod` tagged containers for?
Containers tagged `prod` are production containers based on [minideb](https://github.com/bitnami/minideb). They contain the minimal dependencies required by an application to work.
They don't include development dependencies, so they are commonly used in multi-stage builds as the target image. Application code and dependencies should be copied from a different container.
The resultant containers only contain the necessary pieces of software to run the application. Therefore, they are smaller and safer.
Learn how to use multi-stage builds to build your production application container in the [example](/example) directory
# Get this image
The recommended way to get the Bitnami PHP-FPM Docker Image is to pull the prebuilt image from the [Docker Hub Registry](https://hub.docker.com/r/bitnami/php-fpm).
```bash
$ docker pull bitnami/php-fpm:latest
```
To use a specific version, you can pull a versioned tag. You can view the [list of available versions](https://hub.docker.com/r/bitnami/php-fpm/tags/) in the Docker Hub Registry.
```bash
$ docker pull bitnami/php-fpm:[TAG]
```
If you wish, you can also build the image yourself.
```bash
$ docker build -t bitnami/php-fpm 'https://github.com/bitnami/bitnami-docker-php-fpm.git#master:7.3/debian-9'
```
# Connecting to other containers
This image is designed to be used with a web server to serve your PHP app, you can use docker networking to create a network and attach all the containers to that network.
## Serving your PHP app through an nginx frontend
We will use PHP-FPM with nginx to serve our PHP app. Doing so will allow us to setup more complex configuration, serve static assets using nginx, load balance to different PHP-FPM instances, etc.
### Step 1: Create a network
```bash
$ docker network create app-tier --driver bridge
```
or using Docker Compose:
```yaml
version: '2'
networks:
app-tier:
driver: bridge
```
### Step 2: Create a server block
Let's create an nginx server block to reverse proxy to our PHP-FPM container.
```nginx
server {
listen 0.0.0.0:80;
server_name myapp.com;
root /app;
location / {
try_files $uri $uri/index.php;
}
location ~ \.php$ {
# fastcgi_pass [PHP_FPM_LINK_NAME]:9000;
fastcgi_pass phpfpm:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
```
Notice we've substituted the link alias name `myapp`, we will use the same name when creating the container.
Copy the server block above, saving the file somewhere on your host. We will mount it as a volume in our nginx container.
### Step 3: Run the PHP-FPM image with a specific name
Docker's linking system uses container ids or names to reference containers. We can explicitly specify a name for our PHP-FPM server to make it easier to connect to other containers.
```bash
$ docker run -it --name phpfpm \
--network app-tier
-v /path/to/app:/app \
bitnami/php-fpm
```
or using Docker Compose:
```yaml
services:
phpfpm:
image: 'bitnami/php-fpm:latest'
networks:
- app-tier
volumes:
- /path/to/app:/app
```
### Step 4: Run the nginx image
```bash
$ docker run -it \
-v /path/to/server_block.conf:/opt/bitnami/nginx/conf/server_blocks/yourapp.conf \
--network app-tier \
bitnami/nginx
```
or using Docker Compose:
```yaml
services:
nginx:
image: 'bitnami/nginx:latest'
depends_on:
- phpfpm
networks:
- app-tier
ports:
- '80:80'
- '443:443'
volumes:
- /path/to/server_block.conf:/opt/bitnami/nginx/conf/server_blocks/yourapp.conf
```
# PHP runtime
Since this image bundles a PHP runtime, you may want to make use of PHP outside of PHP-FPM. By default, running this image will start a server. To use the PHP runtime instead, we can override the the default command Docker runs by stating a different command to run after the image name.
## Entering the REPL
PHP provides a REPL where you can interactively test and try things out in PHP.
```bash
$ docker run -it --name phpfpm bitnami/php-fpm php -a
```
**Further Reading:**
- [PHP Interactive Shell Documentation](http://php.net/manual/en/features.commandline.interactive.php)
# Running your PHP script
The default work directory for the PHP-FPM image is `/app`. You can mount a folder from your host here that includes your PHP script, and run it normally using the `php` command.
```bash
$ docker run -it --name php-fpm -v /path/to/app:/app bitnami/php-fpm \
php script.php
```
# Configuration
## Mount a custom config file
You can mount a custom config file from your host to edit the default configuration for the php-fpm docker image. The following is an example to alter the configuration of the _php-fpm.conf_ configuration file:
### Step 1: Run the PHP-FPM image
Run the PHP-FPM image, mounting a file from your host.
```bash
$ docker run --name phpfpm -v /path/to/php-fpm.conf:/opt/bitnami/php/etc/php-fpm.conf bitnami/php-fpm
```
or by modifying the [`docker-compose.yml`](https://github.com/bitnami/bitnami-docker-php-fpm/blob/master/docker-compose.yml) file present in this repository:
```yaml
services:
phpfpm:
...
volumes:
- /path/to/php-fpm.conf:/opt/bitnami/php/etc/php-fpm.conf
...
```
### Step 2: Edit the configuration
Edit the configuration on your host using your favorite editor.
```bash
$ vi /path/to/php-fpm.conf
```
### Step 3: Restart PHP-FPM
After changing the configuration, restart your PHP-FPM container for the changes to take effect.
```bash
$ docker restart phpfpm
```
or using Docker Compose:
```bash
$ docker-compose restart phpfpm
```
## Add additional .ini files
PHP has been configured at compile time to scan the `/opt/bitnami/php/etc/conf.d/` folder for extra .ini configuration files so it is also possible to mount your customizations there.
Multiple files are loaded in alphabetical order. It is common to have a file per extension and use a numeric prefix to guarantee an order loading the configuration.
Please check [http://php.net/manual/en/configuration.file.php#configuration.file.scan](http://php.net/manual/en/configuration.file.php#configuration.file.scan) to know more about this feature.
In order to override the default `max_file_uploads` settings you can do the following:
1. Create a file called _custom.ini_ with the following content:
```
max_file_uploads = 30M
```
2. Run the php-fpm container mounting the custom file.
```bash
$ docker run -it -v /path/to/custom.ini:/opt/bitnami/php/etc/conf.d/custom.ini bitnami/php-fpm php -i | grep max_file_uploads
```
You should see that PHP is using the new specified value for the `max_file_uploads` setting.
# Logging
The Bitnami PHP-FPM Docker Image sends the container logs to the `stdout`. You can configure the containers [logging driver](https://docs.docker.com/engine/reference/run/#logging-drivers-log-driver) using the `--log-driver` option. By defauly the `json-file` driver is used.
To view the logs:
```bash
$ docker logs phpfpm
```
or using Docker Compose:
```bash
$ docker-compose logs phpfpm
```
*The `docker logs` command is only available when the `json-file` or `journald` logging driver is in use.*
# Maintenance
## Upgrade this image
Bitnami provides up-to-date versions of PHP-FPM, including security patches, soon after they are made upstream. We recommend that you follow these steps to upgrade your container.
### Step 1: Get the updated image
```bash
$ docker pull bitnami/php-fpm:latest
```
or if you're using Docker Compose, update the value of the image property to
`bitnami/php-fpm:latest`.
### Step 2: Stop and backup the currently running container
Stop the currently running container using the command
```bash
$ docker stop php-fpm
```
or using Docker Compose:
```bash
$ docker-compose stop php-fpm
```
Next, take a snapshot of the persistent volume `/path/to/php-fpm-persistence` using:
```bash
$ rsync -a /path/to/php-fpm-persistence /path/to/php-fpm-persistence.bkp.$(date +%Y%m%d-%H.%M.%S)
```
You can use this snapshot to restore the database state should the upgrade fail.
### Step 3: Remove the currently running container
```bash
$ docker rm -v phpfpm
```
or using Docker Compose:
```bash
$ docker-compose rm -v phpfpm
```
### Step 4: Run the new image
Re-create your container from the new image.
```bash
$ docker run --name phpfpm bitnami/php-fpm:latest
```
or using Docker Compose:
```bash
$ docker-compose up phpfpm
```
# Useful Links
- [Create An AMP Development Environment With Bitnami Containers
](https://docs.bitnami.com/containers/how-to/create-amp-environment-containers/)
- [Create An EMP Development Environment With Bitnami Containers
](https://docs.bitnami.com/containers/how-to/create-emp-environment-containers/)
# Notable Changes
## 7.2.3-r2, 7.1.15-r2, 7.0.28-r2 and 5.6.34-r2 (2018-03-13)
- PHP has been configured at compile time to scan the `/opt/bitnami/php/etc/conf.d/` folder for extra .ini configuration files.
## 7.0.6-r0 (2016-05-17)
- All volumes have been merged at `/bitnami/php-fpm`. Now you only need to mount a single volume at `/bitnami/php-fpm` for persistence.
- The logs are always sent to the `stdout` and are no longer collected in the volume.
## 5.5.30-2 (2015-12-07)
- Enables support for imagick extension
## 5.5.30-0-r01 (2015-11-10)
- `php.ini` is now exposed in the volume mounted at `/bitnami/php-fpm/conf/` allowing users to change the defaults as per their requirements.
## 5.5.30-0 (2015-10-06)
- `/app` directory is no longer exported as a volume. This caused problems when building on top of the image, since changes in the volume are not persisted between Dockerfile `RUN` instructions. To keep the previous behavior (so that you can mount the volume in another container), create the container with the `-v /app` option.
# Contributing
We'd love for you to contribute to this Docker image. You can request new features by creating an [issue](https://github.com/bitnami/bitnami-docker-php-fpm/issues), or submit a [pull request](https://github.com/bitnami/bitnami-docker-php-fpm/pulls) with your contribution.
# Issues
If you encountered a problem running this container, you can file an [issue](https://github.com/bitnami/bitnami-docker-php-fpm/issues). For us to provide better support, be sure to include the following information in your issue:
- Host OS and version
- Docker version (`docker version`)
- Output of `docker info`
- Version of this container (`echo $BITNAMI_IMAGE_VERSION` inside the container)
- The command you used to run the container, and any relevant output you saw (masking any sensitive information)
# License
Copyright (c) 2015-2019 Bitnami
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
version: '2'
services:
php:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/php-fpm:7.3'
ports:
- 9000:9000
volumes:
- .:/app
FROM bitnami/php-fpm:7.1 as builder
COPY . /app
WORKDIR /app
# Optionally install application dependencies here. For example using composer.
FROM bitnami/php-fpm:7.1-prod
COPY --from=builder /app /app
WORKDIR /app
EXPOSE 9000
CMD ["php-fpm", "-F", "--pid" , "/opt/bitnami/php/tmp/php-fpm.pid", "-c", "/opt/bitnami/php/conf/php-fpm.conf"]
# Example Application
## TL;DR
```bash
$ kubectl create -f https://raw.githubusercontent.com/bitnami/bitnami-docker-php-fpm/master/example/kubernetes.yml
```
## Introduction
This example demostrates the use of the `bitnami/php-fpm` image to create a production build of your php application.
For demonstration purposes we will create a phpinfo application, build a image with the tag `bitnami/php-example` and deploy it on a [Kubernetes](https://kubernetes.io) cluster.
## Generate the application
The example application is just the next snippet to show the phpinfo page.
```php
<?php
phpinfo();
?>
```
## Build and Test
To build a production Docker image of our application we'll use the `bitnami/php-fpm:6-prod` image, which is a production build of the Bitnami PHP-FPM Image optimized for size.
```dockerfile
FROM bitnami/php-fpm:7.1 as builder
COPY . /app
WORKDIR /app
# Optionally install application dependencies here. For example using composer.
FROM bitnami/php-fpm:7.1-prod
COPY --from=builder /app /app
WORKDIR /app
EXPOSE 9000
CMD ["php-fpm", "-F", "--pid" , "/opt/bitnami/php/tmp/php-fpm.pid", "-c", "/opt/bitnami/php/conf/php-fpm.conf"]
```
The `Dockerfile` consists of two build stages. The first stage uses the development image, `bitnami/php-fpm:7.1`, to copy the application source and install the required application dependencies if required.
The second stage uses the production image, `bitnami/php-fpm:7.1-prod`, and copies over the application source and the dependencies from the previous stage. This creates a minimal Docker image that only consists of the application source and dependencies and the php runtime.
> **Note**
>
> We don't need a multistage build for this specific example as the application does not have dependencies but it is done in this way to demostrate how should be used.
To build the Docker image, execute the command:
```bash
$ docker build -t bitnami/php-example:0.0.1 example/
```
Since the `bitnami/php-fpm:7.1-prod` image is optimized for production deployments it does not include any packages that would bloat the image.
```console
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
bitnami/php-example 0.0.1 8c72c8c9a73e 32 minutes ago 202MB
```
You can now launch and test the image locally. We will need a web server like Nginx to server our php app with PHP-FPM. The following docker-compose file deploys both the php application and the nginx server mounting an already configured server block.
```yaml
version: '2'
services:
phpfpm:
image: 'bitnami/php-example:0.0.1'
nginx:
image: 'bitnami/nginx:latest'
depends_on:
- phpfpm
ports:
- '8080:8080'
- '8443:8443'
volumes:
- ./server_blocks/myapp.conf:/opt/bitnami/nginx/conf/server_blocks/myapp.conf
```
You can start the deployment with this command:
```
$ docker-compose up
```
Finally you can access your application at http://your-ip:8080
## Deployment
The `kubernetes.yml` file from the `example/` folder can be used to deploy our `bitnami/php-example:0.0.1` image to a Kubernetes cluster.
Simply download the Kubernetes manifest and create the Kubernetes resources described in the manifest using the command:
```console
$ kubectl create -f kubernetes.yml
ingress "example-ingress" created
service "example-svc" created
service "nginx-svc" created
configmap "example-configmap" created
persistentvolumeclaim "example-data-pvc" created
deployment "example-deployment" created
deployment "nginx-deployment" created
configmap "nginx-configmap" created
```
From the output of the above command you will notice that we create the following resources:
- [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/)
- [Service](https://kubernetes.io/docs/concepts/services-networking/service/)
- [Volume](https://kubernetes.io/docs/concepts/storage/volumes/)
+ [ConfigMap](https://kubernetes.io/docs/concepts/storage/volumes/#projected)
+ [PersistentVolumeClaim](https://kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim)
- [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/)
> **Note**
>
> Our example application is stateless and does not store any data or does not require any user configurations. As such we do not need to create the `ConfigMap` or `PersistentVolumeClaim` resources. Our `kubernetes.yml` creates these resources strictly to demostrate how they are defined in the manifest.
## Accessing the application
Typically in production you would access the application via a Ingress controller. Our `kubernetes.yml` already defines a `Ingress` resource. Please refer to the [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) documentation to learn how to deploy an ingress controller in your cluster.
> **Hint**
>
> https://kubeapps.com/charts/stable/nginx-ingress
The following are alternate ways of accessing the application, typically used during application development and testing.
Since the service `example-nginx` is defined to be of type `NodePort`, we can set up port forwarding to access our web application like so:
```bash
$ kubectl port-forward $(kubectl get pods -l app=nginx -o jsonpath="{ .items[0].metadata.name }") 8080:8080
```
The command forwards the local port `8080` to port `8080` of the Pod container. You can access the application by visiting the http://localhost:8080.
> **Note:**
>
> If your using minikube, you can access the application by simply executing the following command:
>
> ```bash
> $ minikube service example-svc
> ```
## Health Checks
The `kubernetes.yml` manifest defines default probes to check the health of the application. For our application we are simply probing if the application is responsive to queries on the root resource.
You application can define a route, such as the commonly used `/healthz`, that reports the application status and use that route in the health probes.
version: '2'
services:
phpfpm:
image: 'bitnami/php-example:0.0.1'
nginx:
image: 'bitnami/nginx:latest'
depends_on:
- phpfpm
ports:
- '8080:8080'
- '8443:8443'
volumes:
- ./server_blocks/myapp.conf:/opt/bitnami/nginx/conf/server_blocks/myapp.conf
<?php
phpinfo();
?>
\ No newline at end of file
apiVersion: v1
items:
- apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: example-ingress
labels:
app: example
annotations:
spec:
rules:
- host: app.example.com
http:
paths:
- path: /
backend:
serviceName: nginx-svc
servicePort: 80
tls:
- apiVersion: v1
kind: Service
metadata:
name: example-svc
labels:
app: example
spec:
ports:
- name: http
port: 9000
targetPort: 9000
selector:
app: example
status:
loadBalancer: {}
- apiVersion: v1
kind: Service
metadata:
name: nginx-svc
labels:
app: nginx
spec:
ports:
- name: http
port: 80
targetPort: http
selector:
app: nginx
type: NodePort
status:
loadBalancer: {}
- apiVersion: v1
kind: ConfigMap
metadata:
name: example-configmap
labels:
app: example
data:
config.ini: |-
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: example-data-pvc
annotations: {}
labels:
app: example
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
status: {}
- apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: example-deployment
labels:
app: example
spec:
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: example
spec:
containers:
- name: example
image: bitnami/php-example:0.0.1
ports:
- containerPort: 9000
name: http
volumeMounts:
- mountPath: /app/config.ini
name: example-config
subPath: config.ini
- mountPath: /app/data
name: example-data
readinessProbe:
tcpSocket:
port: http
initialDelaySeconds: 10
timeoutSeconds: 5
restartPolicy: Always
volumes:
- name: example-config
configMap:
name: example-configmap
- name: example-data
persistentVolumeClaim:
claimName: example-data-pvc
status: {}
- apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: bitnami/nginx:latest
ports:
- containerPort: 8080
name: http
livenessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 5
timeoutSeconds: 1
volumeMounts:
- name: nginx-server-blocks
mountPath: /bitnami/nginx/conf/server_blocks
volumes:
- name: nginx-server-blocks
configMap:
name: nginx-configmap
restartPolicy: Always
status: {}
- apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-configmap
labels:
app: nginx
data:
myapp.conf: |-
server {
listen 0.0.0.0:8080;
server_name myapp.com;
root /app;
location / {
try_files $uri $uri/index.php;
}
location ~ \.php$ {
# fastcgi_pass example-svc:9000;
fastcgi_pass example-svc:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
kind: List
metadata: {}
server {
listen 0.0.0.0:8080;
server_name myapp.com;
root /app;
location / {
try_files $uri $uri/index.php;
}
location ~ \.php$ {
# fastcgi_pass [PHP_FPM_LINK_NAME]:9000;
fastcgi_pass phpfpm:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
\ No newline at end of file
## This is test deployment for Kubernetes platforms.
## This is _not_ intended to be use in producction.
##
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: test-php-fpm
name: test-php-fpm
spec:
replicas: 1
selector:
matchLabels:
app: test-php-fpm
template:
metadata:
labels:
app: test-php-fpm
spec:
containers:
- image: bitnami/php-fpm
name: php-fpm
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
#
# Copyright (C) 2018 XueTong Tech Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM registry-vpc.cn-hangzhou.aliyuncs.com/schbrain/nginx:2.3.2_1
MAINTAINER xt
COPY nginx.conf /usr/local/nginx/conf/nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
# load modules compiled as Dynamic Shared Object (DSO)
#
#dso {
# load ngx_http_fastcgi_module.so;
# load ngx_http_rewrite_module.so;
#}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" $http_host '
'$status $request_length $body_bytes_sent "$http_referer" '
'"$http_user_agent" $request_time $upstream_response_time';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80 default;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /app;
index index.php;
}
location ~ \.php$ {
fastcgi_pass thinksns.jianlan:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /app/$fastcgi_script_name;
include fastcgi_params;
}
location ~.*/*\.html$ {
root /var/app;
add_header Cache-Control "no-cache, no-store, max-age=0, must-revalidate";
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment