Skip to content

Commit

Permalink
[Add] 8.0.6-fpm-1.18.0-nginx-alpine3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
dwchiang committed Jun 15, 2021
1 parent 5b28b4e commit 3d091e6
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 5 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pushtodockerhub: version
docker buildx ls
docker buildx create --append --name buildnginxphpfpm
docker buildx use buildnginxphpfpm
docker buildx inspect --bootstrap

ifeq ($(IS_LATEST),true)
echo 'IS_LATEST=true'
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ You may also be interested in: [Workshops: Running Laravel on AWS ECS](https://g
## PHP 8.0

- [`8.0.6-fpm-1.18.0-nginx-buster`](https://github.com/dwchiang/nginx-php-fpm/blob/master/buster/Dockerfile-8.0.6-fpm-1.18.0-nginx-buster), `latest`
- [`8.0.6-fpm-1.18.0-nginx-alpine3.12`](https://github.com/dwchiang/nginx-php-fpm/blob/master/alpine3.12/Dockerfile-8.0.6-fpm-1.18.0-nginx-alpine3.12)
- [`8.0.5-fpm-1.18.0-nginx-buster`](https://github.com/dwchiang/nginx-php-fpm/blob/master/buster/Dockerfile-8.0.5-fpm-1.18.0-nginx-buster),
- [`8.0.5-fpm-1.18.0-nginx-alpine3.12`](https://github.com/dwchiang/nginx-php-fpm/blob/master/alpine3.12/Dockerfile-8.0.5-fpm-1.18.0-nginx-alpine3.12)
- [`8.0.3-fpm-1.18.0-nginx-buster`](https://github.com/dwchiang/nginx-php-fpm/blob/master/buster/Dockerfile-8.0.3-fpm-1.18.0-nginx-buster)
Expand Down
157 changes: 157 additions & 0 deletions alpine3.12/Dockerfile-8.0.6-fpm-1.18.0-nginx-alpine3.12
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
FROM php:8.0.6-fpm-alpine3.12

LABEL maintainer="Ernest Chiang <me@ernestchiang.com>"

ARG VERSION_OS
ENV VERSION_OS=${VERSION_OS}

### ----------------------------------------------------------
# Proper iconv #240
# Ref: https://github.com/docker-library/php/issues/240
### ----------------------------------------------------------

ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv

### ----------------------------------------------------------
### Part 1 of Nginx Dockerfile source https://hub.docker.com/_/nginx/
### https://github.com/nginxinc/docker-nginx/blob/9774b522d4661effea57a1fbf64c883e699ac3ec/stable/alpine/Dockerfile
### ----------------------------------------------------------

ENV NGINX_VERSION 1.18.0
ENV NJS_VERSION 0.4.2
ENV PKG_RELEASE 1

RUN set -x \
# create nginx user/group first, to be consistent throughout docker variants
&& addgroup -g 101 -S nginx \
&& adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \
&& apkArch="$(cat /etc/apk/arch)" \
&& nginxPackages=" \
nginx=${NGINX_VERSION}-r${PKG_RELEASE} \
nginx-module-xslt=${NGINX_VERSION}-r${PKG_RELEASE} \
nginx-module-geoip=${NGINX_VERSION}-r${PKG_RELEASE} \
nginx-module-image-filter=${NGINX_VERSION}-r${PKG_RELEASE} \
nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-r${PKG_RELEASE} \
" \
&& case "$apkArch" in \
x86_64) \
# arches officially built by upstream
set -x \
&& KEY_SHA512="e7fa8303923d9b95db37a77ad46c68fd4755ff935d0a534d26eba83de193c76166c68bfe7f65471bf8881004ef4aa6df3e34689c305662750c0172fca5d8552a *stdin" \
&& apk add --no-cache --virtual .cert-deps \
openssl \
&& wget -O /tmp/nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub \
&& if [ "$(openssl rsa -pubin -in /tmp/nginx_signing.rsa.pub -text -noout | openssl sha512 -r)" = "$KEY_SHA512" ]; then \
echo "key verification succeeded!"; \
mv /tmp/nginx_signing.rsa.pub /etc/apk/keys/; \
else \
echo "key verification failed!"; \
exit 1; \
fi \
&& apk del .cert-deps \
&& apk add -X "https://nginx.org/packages/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" --no-cache $nginxPackages \
;; \
*) \
# we're on an architecture upstream doesn't officially build for
# let's build binaries from the published packaging sources
set -x \
&& tempDir="$(mktemp -d)" \
&& chown nobody:nobody $tempDir \
&& apk add --no-cache --virtual .build-deps \
gcc \
libc-dev \
make \
openssl-dev \
pcre-dev \
zlib-dev \
linux-headers \
libxslt-dev \
gd-dev \
geoip-dev \
perl-dev \
libedit-dev \
mercurial \
bash \
alpine-sdk \
findutils \
&& su nobody -s /bin/sh -c " \
export HOME=${tempDir} \
&& cd ${tempDir} \
&& hg clone https://hg.nginx.org/pkg-oss \
&& cd pkg-oss \
&& hg up -r 489 \
&& cd alpine \
&& make all \
&& apk index -o ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz ${tempDir}/packages/alpine/${apkArch}/*.apk \
&& abuild-sign -k ${tempDir}/.abuild/abuild-key.rsa ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz \
" \
&& cp ${tempDir}/.abuild/abuild-key.rsa.pub /etc/apk/keys/ \
&& apk del .build-deps \
&& apk add -X ${tempDir}/packages/alpine/ --no-cache $nginxPackages \
;; \
esac \
# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
&& if [ -n "$tempDir" ]; then rm -rf "$tempDir"; fi \
&& if [ -n "/etc/apk/keys/abuild-key.rsa.pub" ]; then rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \
&& if [ -n "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \
# Bring in gettext so we can get `envsubst`, then throw
# the rest away. To do this, we need to install `gettext`
# then move `envsubst` out of the way so `gettext` can
# be deleted completely, then move `envsubst` back.
&& apk add --no-cache --virtual .gettext gettext \
&& mv /usr/bin/envsubst /tmp/ \
\
&& runDeps="$( \
scanelf --needed --nobanner /tmp/envsubst \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --no-cache $runDeps \
&& apk del .gettext \
&& mv /tmp/envsubst /usr/local/bin/ \
# Bring in tzdata so users could set the timezones through the environment
# variables
&& apk add --no-cache tzdata \
# Bring in curl and ca-certificates to make registering on DNS SD easier
&& apk add --no-cache curl ca-certificates \
# forward request and error logs to docker log collector
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
# create a docker-entrypoint.d directory
&& mkdir /docker-entrypoint.d

COPY alpine3.12/scripts/docker-entrypoint.sh /
COPY alpine3.12/scripts/10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
COPY alpine3.12/scripts/20-envsubst-on-templates.sh /docker-entrypoint.d
# ENTRYPOINT ["/docker-entrypoint.sh"]

EXPOSE 80

STOPSIGNAL SIGTERM

### ----------------------------------------------------------
### Setup supervisord, nginx config
### ----------------------------------------------------------

RUN set -x && \
apk update && apk upgrade && \
apk add --no-cache \
supervisor \
&& \
rm -Rf /etc/nginx/nginx.conf && \
rm -Rf /etc/nginx/conf.d/default.conf && \
# folders
mkdir -p /var/log/supervisor

COPY alpine3.12/conf/supervisord.conf /etc/supervisord.conf
COPY alpine3.12/conf/nginx.conf /etc/nginx/nginx.conf
COPY alpine3.12/conf/nginx-default.conf /etc/nginx/conf.d/default.conf

### ----------------------------------------------------------
### CMD
### ----------------------------------------------------------

CMD ["/docker-entrypoint.sh"]
17 changes: 12 additions & 5 deletions buildOnGitHubActions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export VERSION_OS=buster
### ----------------------------------------------------------
### PHP 8.0

export VERSION_PHP_FPM=8.0.6
export VERSION_NGINX=1.18.0
export VERSION_LARAVEL=8.5.5
export IS_LATEST=true
# export VERSION_PHP_FPM=8.0.6
# export VERSION_NGINX=1.18.0
# export VERSION_LARAVEL=8.5.5
# export IS_LATEST=true

make $BUILD_CMD
# make $BUILD_CMD

# export VERSION_PHP_FPM=8.0.5
# export VERSION_NGINX=1.18.0
Expand Down Expand Up @@ -172,6 +172,13 @@ export VERSION_OS=alpine3.12
### ----------------------------------------------------------
### PHP 8.0

export VERSION_PHP_FPM=8.0.6
export VERSION_NGINX=1.18.0
export VERSION_LARAVEL=8.5.5
export IS_LATEST=false

make $BUILD_CMD

# export VERSION_PHP_FPM=8.0.5
# export VERSION_NGINX=1.18.0
# export VERSION_LARAVEL=8.5.5
Expand Down

0 comments on commit 3d091e6

Please sign in to comment.