diff --git a/dockerfiles/Dockerfile.adminer b/dockerfiles/Dockerfile.adminer new file mode 100644 index 0000000..96df10b --- /dev/null +++ b/dockerfiles/Dockerfile.adminer @@ -0,0 +1,31 @@ +# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 +ARG NDIST=12 +ARG REGISTRY=pubdocker.univ-reunion.fr + +FROM $REGISTRY/src/base AS base +FROM $REGISTRY/src/php AS php + +################################################################################ +FROM debian:${NDIST}-slim AS builder +ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE +ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=base /src/ /src/ +RUN /g/build core lite _builder +RUN /g/build _su-exec_builder + +################################################################################ +FROM debian:${NDIST}-slim +ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE +ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=builder /src/su-exec/su-exec /g/ +RUN /g/build + +COPY --from=php /g/ /g/ +RUN /g/build -a @adminer + +EXPOSE 80 +ENTRYPOINT ["/g/entrypoint"] diff --git a/dockerfiles/Dockerfile.adminer+ic b/dockerfiles/Dockerfile.adminer+ic new file mode 100644 index 0000000..609ee69 --- /dev/null +++ b/dockerfiles/Dockerfile.adminer+ic @@ -0,0 +1,40 @@ +# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 +ARG NDIST=12 +ARG REGISTRY=pubdocker.univ-reunion.fr + +FROM $REGISTRY/src/base AS base +FROM $REGISTRY/src/instantclient AS instantclient +FROM $REGISTRY/src/php AS php + +################################################################################ +FROM debian:${NDIST}-slim AS builder +ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE +ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=base /src/ /src/ +RUN /g/build core lite _builder +RUN /g/build _su-exec_builder + +COPY --from=instantclient /g/ /g/ +COPY --from=instantclient /src/ /src/ +RUN /g/build _instantclient_builder + +################################################################################ +FROM debian:${NDIST}-slim +ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE +ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=builder /src/su-exec/su-exec /g/ +RUN /g/build + +COPY --from=php /g/ /g/ +RUN /g/build -a @adminer + +COPY --from=instantclient /g/ /g/ +COPY --from=builder /opt/oracle/ /opt/oracle/ +RUN /g/build instantclient + +EXPOSE 80 +ENTRYPOINT ["/g/entrypoint"] diff --git a/dockerfiles/Dockerfile.mariadb10 b/dockerfiles/Dockerfile.mariadb10 new file mode 100644 index 0000000..f26efd5 --- /dev/null +++ b/dockerfiles/Dockerfile.mariadb10 @@ -0,0 +1,19 @@ +# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 +ARG REGISTRY=pubdocker.univ-reunion.fr +FROM $REGISTRY/src/base AS base +FROM $REGISTRY/src/mariadb AS mariadb +FROM $REGISTRY/src/legacytools AS legacytools + +FROM mariadb:10 +ARG APT_PROXY TIMEZONE +ENV APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=mariadb /g/ /g/ +RUN /g/build -a @base @mariadb + +COPY --from=legacytools /g/ /g/ +RUN /g/build nutools servertools + +EXPOSE 3306 +ENTRYPOINT ["/g/entrypoint"] diff --git a/dockerfiles/Dockerfile.php-apache b/dockerfiles/Dockerfile.php-apache new file mode 100644 index 0000000..3d5adf4 --- /dev/null +++ b/dockerfiles/Dockerfile.php-apache @@ -0,0 +1,31 @@ +# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 +ARG NDIST=12 +ARG REGISTRY=pubdocker.univ-reunion.fr + +FROM $REGISTRY/src/base AS base +FROM $REGISTRY/src/php AS php + +################################################################################ +FROM debian:${NDIST}-slim AS builder +ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE +ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=base /src/ /src/ +RUN /g/build core lite _builder +RUN /g/build _su-exec_builder + +################################################################################ +FROM debian:${NDIST}-slim +ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE +ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=builder /src/su-exec/su-exec /g/ +RUN /g/build + +COPY --from=php /g/ /g/ +RUN /g/build -a @apache-php-cas php-utils + +EXPOSE 80 443 +ENTRYPOINT ["/g/entrypoint"] diff --git a/dockerfiles/Dockerfile.php-apache+ic b/dockerfiles/Dockerfile.php-apache+ic new file mode 100644 index 0000000..9c3cd80 --- /dev/null +++ b/dockerfiles/Dockerfile.php-apache+ic @@ -0,0 +1,44 @@ +# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 +ARG NDIST=12 +ARG REGISTRY=pubdocker.univ-reunion.fr + +FROM $REGISTRY/src/base AS base +FROM $REGISTRY/src/legacytools AS legacytools +FROM $REGISTRY/src/instantclient AS instantclient +FROM $REGISTRY/src/php AS php + +################################################################################ +FROM debian:${NDIST}-slim AS builder +ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE +ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=base /src/ /src/ +RUN /g/build core lite _builder +RUN /g/build _su-exec_builder + +COPY --from=instantclient /g/ /g/ +COPY --from=instantclient /src/ /src/ +RUN /g/build _instantclient_builder + +################################################################################ +FROM debian:${NDIST}-slim +ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE +ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=builder /src/su-exec/su-exec /g/ +RUN /g/build + +COPY --from=legacytools /g/ /g/ +RUN /g/build nutools + +COPY --from=php /g/ /g/ +RUN /g/build -a @apache-php-cas php-utils + +COPY --from=instantclient /g/ /g/ +COPY --from=builder /opt/oracle/ /opt/oracle/ +RUN /g/build instantclient + +EXPOSE 80 443 +ENTRYPOINT ["/g/entrypoint"] diff --git a/dockerfiles/Dockerfile.php-cli b/dockerfiles/Dockerfile.php-cli new file mode 100644 index 0000000..ef17f83 --- /dev/null +++ b/dockerfiles/Dockerfile.php-cli @@ -0,0 +1,30 @@ +# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 +ARG NDIST=12 +ARG REGISTRY=pubdocker.univ-reunion.fr + +FROM $REGISTRY/src/base AS base +FROM $REGISTRY/src/php AS php + +################################################################################ +FROM debian:${NDIST}-slim AS builder +ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE +ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=base /src/ /src/ +RUN /g/build core lite _builder +RUN /g/build _su-exec_builder + +################################################################################ +FROM debian:${NDIST}-slim +ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE +ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=builder /src/su-exec/su-exec /g/ +RUN /g/build + +COPY --from=php /g/ /g/ +RUN /g/build @php-cli php-utils + +ENTRYPOINT ["/g/entrypoint"] diff --git a/dockerfiles/Dockerfile.php-cli+ic b/dockerfiles/Dockerfile.php-cli+ic new file mode 100644 index 0000000..b380090 --- /dev/null +++ b/dockerfiles/Dockerfile.php-cli+ic @@ -0,0 +1,43 @@ +# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 +ARG NDIST=12 +ARG REGISTRY=pubdocker.univ-reunion.fr + +FROM $REGISTRY/src/base AS base +FROM $REGISTRY/src/legacytools AS legacytools +FROM $REGISTRY/src/instantclient AS instantclient +FROM $REGISTRY/src/php AS php + +################################################################################ +FROM debian:${NDIST}-slim AS builder +ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE +ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=base /src/ /src/ +RUN /g/build core lite _builder +RUN /g/build _su-exec_builder + +COPY --from=instantclient /g/ /g/ +COPY --from=instantclient /src/ /src/ +RUN /g/build _instantclient_builder + +################################################################################ +FROM debian:${NDIST}-slim +ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE +ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=builder /src/su-exec/su-exec /g/ +RUN /g/build + +COPY --from=legacytools /g/ /g/ +RUN /g/build nutools + +COPY --from=php /g/ /g/ +RUN /g/build @php-cli php-utils + +COPY --from=instantclient /g/ /g/ +COPY --from=builder /opt/oracle/ /opt/oracle/ +RUN /g/build instantclient + +ENTRYPOINT ["/g/entrypoint"] diff --git a/dockerfiles/Dockerfile.postgres15 b/dockerfiles/Dockerfile.postgres15 new file mode 100644 index 0000000..f9b4db9 --- /dev/null +++ b/dockerfiles/Dockerfile.postgres15 @@ -0,0 +1,16 @@ +# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 +ARG REGISTRY=pubdocker.univ-reunion.fr +FROM $REGISTRY/src/base AS base +FROM $REGISTRY/src/postgres AS postgres + +FROM postgres:15-bookworm +ARG APT_PROXY TIMEZONE +ENV APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE + +COPY --from=base /g/ /g/ +COPY --from=postgres /g/ /g/ +RUN /g/build -a @base @postgres +RUN /g/pkg i @ssl @git + +EXPOSE 5432 +ENTRYPOINT ["/g/entrypoint"] diff --git a/runphp/build b/runphp/build index be175ae..8368e79 100755 --- a/runphp/build +++ b/runphp/build @@ -72,9 +72,9 @@ function _build() { dockerfiles=( "$MYDIR/Dockerfile.$1.local" "$MYDIR/Dockerfile.$1$BUILD_FLAVOUR" - "$PROJDIR/$VENDORDIR/nulib/php/support/Dockerfile.$1$BUILD_FLAVOUR" + "$PROJDIR/$VENDORDIR/nulib/php/dockerfiles/Dockerfile.$1$BUILD_FLAVOUR" "$MYDIR/Dockerfile.$1" - "$PROJDIR/$VENDORDIR/nulib/php/support/Dockerfile.$1" + "$PROJDIR/$VENDORDIR/nulib/php/dockerfiles/Dockerfile.$1" ) for dockerfile in "${dockerfiles[@]}"; do [ -f "$dockerfile" ] && break diff --git a/runphp/runphp.2postamble b/runphp/runphp.2postamble index f7c7cbd..53ed5a2 100644 --- a/runphp/runphp.2postamble +++ b/runphp/runphp.2postamble @@ -202,7 +202,8 @@ if [ -z "$_RUNDK_IN_DOCKER" ]; then after_source_buildenv fi if [ -z "$IMAGE" ]; then - [ -n "$PRIVAREG" ] && IMAGE="$PRIVAREG/$IMAGENAME:$DIST" || IMAGE="$REGISTRY/$IMAGENAME:$DIST" + [[ "$IMAGENAME" == */ ]] && imagename=runphp || imagename="${IMAGENAME%/*}/runphp" + [ -n "$PRIVAREG" ] && IMAGE="$PRIVAREG/$imagename:$DIST" || IMAGE="$REGISTRY/$imagename:$DIST" fi if [ -z "$(docker image ls --no-trunc --format '{{.Repository}}:{{.Tag}}' "$IMAGE" 2>/dev/null)" ]; then bootstrap=1 @@ -300,7 +301,8 @@ OPTIONS fi [ -n "$Dist" ] && DIST="$Dist" if [ -z "$IMAGE" ]; then - [ -n "$PRIVAREG" ] && IMAGE="$PRIVAREG/$IMAGENAME:$DIST" || IMAGE="$REGISTRY/$IMAGENAME:$DIST" + [[ "$IMAGENAME" == */ ]] && imagename=runphp || imagename="${IMAGENAME%/*}/runphp" + [ -n "$PRIVAREG" ] && IMAGE="$PRIVAREG/$imagename:$DIST" || IMAGE="$REGISTRY/$imagename:$DIST" fi if [ -z "$UnlessExists" -o -z "$(docker image ls --no-trunc --format '{{.Repository}}:{{.Tag}}' "$IMAGE" 2>/dev/null)" ]; then eecho "== Building $IMAGE" diff --git a/runphp/template.sh b/runphp/template.sh new file mode 100755 index 0000000..233c527 --- /dev/null +++ b/runphp/template.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 +# Modèle de script utilisant runphp pour lancer un traitement dans un container +# RUNPHP est le chemin relatif vers runphp à partir du chemin du script +RUNPHP=sbin/runphp + +MYDIR="$(dirname -- "$0")"; MYNAME="$(basename -- "$0")" +if [ -z "$_RUNPHP_IN_DOCKER" ]; then + "$MYDIR/$RUNPHP" --bs --ue --ci || exit 1 + exec "$MYDIR/$RUNPHP" "$0" "$@" +fi +source "$MYDIR/$RUNPHP" || exit 1 +source "$PROJDIR/$VENDORDIR/nulib/php/load.sh" || exit 1 + +args=( + "description" + #"usage" +) +parse_args "$@"; set -- "${args[@]}" + +echo "je tourne dans un container..." +sleep 1000