Skip to content

Feature/add php #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish all php docker images
on: [push]
jobs:
login:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: azure/docker-login@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Publish All
run: ./publish-all.sh
shell: bash
working-directory: ./polyscripting/tools/
25 changes: 9 additions & 16 deletions 7.2/alpine3.11/fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM polyverse/php-polyscripting-builder:latest as builder

FROM polyverse/php-polyscripting-builder:latest as polyscripter
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
Expand All @@ -10,7 +9,7 @@ FROM alpine:3.11

# dependencies required for running "phpize"
# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed)
ENV PHPIZE_DEPS \
ENV PHPIZE_DEPS bison bash \
autoconf \
dpkg-dev dpkg \
file \
Expand All @@ -23,15 +22,10 @@ ENV PHPIZE_DEPS \

# persistent / runtime deps
RUN apk add --no-cache \
$PHPIZE_DEPS \
ca-certificates \
curl \
tar \
vim \
bison \
xz \
libxml2-dev \
bash \
# https://github.com/docker-library/php/issues/494
openssl

Expand Down Expand Up @@ -61,18 +55,17 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-gr
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV PHP_LDFLAGS="-Wl,-O1 -pie"

ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 B1B44D8F021E4E2D6021E995DC9FF8D3EE5AF27F

ENV PHP_VERSION 7.2.27
ENV PHP_URL="https://www.php.net/get/php-7.2.27.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-7.2.27.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="7bd0fb9e3b63cfe53176d1f3565cd686f90b3926217158de5ba57091f49e4c32" PHP_MD5=""
ENV PHP_VERSION 7.2.30
ENV PHP_URL="https://www.php.net/distributions/php-7.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.2.30.tar.xz.asc"
ENV PHP_SHA256="aa93df27b58a45d6c9800ac813245dfdca03490a918ebe515b3a70189b1bf8c3" PHP_MD5=""

RUN set -eux; \
\
Expand Down Expand Up @@ -109,7 +102,7 @@ COPY docker-php-source /usr/local/bin/
ENV POLYSCRIPT_PATH "/usr/local/bin/polyscripting"
ENV PHP_SRC_PATH "/usr/src/php"
WORKDIR $POLYSCRIPT_PATH
COPY --from=builder /polyscripting/ ./
COPY --from=polyscripter /polyscripting/ ./

RUN set -eux; \
apk add --no-cache --virtual .build-deps \
Expand All @@ -136,7 +129,7 @@ RUN set -eux; \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
# make sure invalid --configure-flags are fatal errors instead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
Expand Down Expand Up @@ -242,4 +235,4 @@ STOPSIGNAL SIGQUIT

EXPOSE 9000
CMD ["php-fpm"]
##</autogenerated>##
##</autogenerated>##
15 changes: 14 additions & 1 deletion 7.2/alpine3.11/fpm/publish-image.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
#!/bin/bash

image="polyverse/ps-php7.2-fpm"
echo "HERE WE GO"
echo "fdafdsfasdfsadfsdafdsafdsafafdsafdsafdsafdsafsadfdsafsdafdsaf \
fdafdsafsdfsadfsafsdafsadfasdf \
dfasdfsdafasdfdsafsdafadsfasdf \n fdsafdsfasdfdsa fdsafsafsadfads \nhhhhhh"

# Copyright (c) 2020 Polyverse Corporation

type="$(basename $PWD)"
build="$(basename $(dirname $PWD))"
php_ver="$(basename $(dirname $(dirname $PWD)))"
image="polyverse/ps-php${php_ver}-${build}-${type}"

echo "Image $image being built"

echo "$(date) Obtaining current git sha for tagging the docker image"
headsha=$(git rev-parse --verify HEAD)
Expand All @@ -12,4 +24,5 @@ if [[ "$1" == "-p" ]]; then
echo "Pushing as latest tag..."
docker tag $image:$headsha $image:latest
docker push $image:latest
docker push $image:$headsha
fi
27 changes: 13 additions & 14 deletions 7.2/stretch/apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
FROM polyverse/php-polyscripting-builder:latest as builder
FROM polyverse/php-polyscripting-builder:latest as polyscripter
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM debian:stretch-slim

Expand All @@ -13,14 +18,13 @@ RUN set -eux; \

# dependencies required for running "phpize"
# (see persistent deps below)
ENV PHPIZE_DEPS \
ENV PHPIZE_DEPS bison bash \
autoconf \
dpkg-dev \
file \
g++ \
gcc \
libc-dev \
vim \
make \
pkg-config \
re2c
Expand All @@ -32,8 +36,6 @@ RUN set -eux; \
$PHPIZE_DEPS \
ca-certificates \
curl \
bison \
libxml2-dev \
xz-utils \
; \
rm -rf /var/lib/apt/lists/*
Expand Down Expand Up @@ -107,7 +109,7 @@ RUN { \
&& a2enconf docker-php

ENV PHP_EXTRA_BUILD_DEPS apache2-dev
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi PHP_EXTRA_VERSION="-polyscripted"
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi
##</autogenerated>##

# Apply stack smash protection to functions using local buffers and alloca()
Expand All @@ -123,7 +125,7 @@ ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"

ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 B1B44D8F021E4E2D6021E995DC9FF8D3EE5AF27F

ENV PHP_VERSION 7.2.28-polyscripted
ENV PHP_VERSION 7.2.28
ENV PHP_URL="https://www.php.net/get/php-7.2.28.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-7.2.28.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="afe1863301da572dee2e0bad8014813bcced162f980ddc8ec8e41fd72263eb2d" PHP_MD5=""

Expand Down Expand Up @@ -167,9 +169,7 @@ COPY docker-php-source /usr/local/bin/
ENV POLYSCRIPT_PATH "/usr/local/bin/polyscripting"
ENV PHP_SRC_PATH "/usr/src/php"
WORKDIR $POLYSCRIPT_PATH
COPY --from=builder /polyscripting/ ./


COPY --from=polyscripter /polyscripting/ ./

RUN set -eux; \
\
Expand Down Expand Up @@ -242,7 +242,6 @@ RUN set -eux; \
--with-libedit \
--with-openssl \
--with-zlib \
PHP_EXTRA_VERSION="-polyscripted" \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
Expand All @@ -251,7 +250,7 @@ RUN set -eux; \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
${POLYSCRIPT_PATH}/polyscript-enable; \
${POLYSCRIPT_PATH}/polyscript-enable; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
Expand All @@ -270,7 +269,8 @@ RUN set -eux; \
| sort -u \
| xargs -r apt-mark manual \
; \
# https://github.com/docker-library/php/issues/443
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
Expand All @@ -287,7 +287,6 @@ ENTRYPOINT ["docker-php-entrypoint"]
STOPSIGNAL SIGWINCH

COPY apache2-foreground /usr/local/bin/

WORKDIR /var/www/html

EXPOSE 80
Expand Down
19 changes: 12 additions & 7 deletions 7.2/stretch/apache/publish-image.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/bash
#!/bin/sh
# Copyright (c) 2020 Polyverse Corporation

image="polyverse/ps-php7.2-apache"
type="$(basename $PWD)"
build="$(basename $(dirname $PWD))"
php_ver="$(basename $(dirname $(dirname $PWD)))"
image="polyverse/ps-php${php_ver}-${build}-${type}"

echo "Image $image being built"

echo "$(date) Obtaining current git sha for tagging the docker image"
headsha=$(git rev-parse --verify HEAD)
Expand All @@ -9,9 +15,8 @@ echo "Building image $image:$headsha"
docker build -t $image:$headsha .

if [[ "$1" == "-p" ]]; then
echo "Pushing as latest tag..."
docker tag $image:$headsha $image:latest
docker push $image:latest
echo "Pushing as latest tag..."
docker tag $image:$headsha $image:latest
docker push $image:latest
docker push $image:$headsha
fi


17 changes: 10 additions & 7 deletions 7.4/alpine3.11/fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FROM polyverse/php-polyscripting-builder:3c6b6ea8c7e2cbb7a04cdff71a65186a28d1c66f as polyscripter
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
Expand All @@ -8,7 +9,7 @@ FROM alpine:3.11

# dependencies required for running "phpize"
# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed)
ENV PHPIZE_DEPS \
ENV PHPIZE_DEPS bison bash \
autoconf \
dpkg-dev dpkg \
file \
Expand Down Expand Up @@ -98,6 +99,12 @@ RUN set -eux; \

COPY docker-php-source /usr/local/bin/

#add polyscripting
ENV POLYSCRIPT_PATH "/usr/local/bin/polyscripting"
ENV PHP_SRC_PATH "/usr/src/php"
WORKDIR $POLYSCRIPT_PATH
COPY --from=polyscripter /polyscripting/ ./

RUN set -eux; \
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
Expand Down Expand Up @@ -159,17 +166,13 @@ RUN set -eux; \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
${POLYSCRIPT_PATH}/polyscript-enable; \
find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source delete; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
Expand Down Expand Up @@ -240,4 +243,4 @@ STOPSIGNAL SIGQUIT

EXPOSE 9000
CMD ["php-fpm"]
##</autogenerated>##
##</autogenerated>##
21 changes: 21 additions & 0 deletions 7.4/alpine3.11/fpm/publish-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Copyright (c) 2020 Polyverse Corporation

type="$(basename $PWD)"
build="$(basename $(dirname $PWD))"
php_ver="$(basename $(dirname $(dirname $PWD)))"
image="polyverse/ps-php${php_ver}-${build}-${type}"

echo "Image $image being built"

echo "$(date) Obtaining current git sha for tagging the docker image"
headsha=$(git rev-parse --verify HEAD)

echo "Building image $image:$headsha"
docker build -t $image:$headsha .

if [[ "$1" == "-p" ]]; then
echo "Pushing as latest tag..."
docker tag $image:$headsha $image:latest
docker push $image:latest
fi
Loading