diff --git a/.github/workflows/buildx-platform.yml b/.github/workflows/buildx-platform.yml index f6e3027..95c981f 100644 --- a/.github/workflows/buildx-platform.yml +++ b/.github/workflows/buildx-platform.yml @@ -5,6 +5,7 @@ on: branches: - 'master' - 'develop' + - 'feature/php_versions' # no concurrency, cancel previous running workflow concurrency: @@ -68,8 +69,8 @@ jobs: env: REGISTRY_IMAGE: pifou25/jeedom - TAG_NAME: ${{ matrix.debian }}-${{ matrix.php }}${{ matrix.target == 'light' && '-light' || '' }}${{ matrix.jeedom == 'beta' && '-beta' || '' }}${{ matrix.xdebug && '-debug' || '' }}${{ github.ref_name != 'master' && '-dev' || '' }} - TAG_LATEST_ENABLED: ${{ (matrix.debian == 'bullseye' && matrix.target == 'full' && matrix.jeedom == 'V4-stable' && matrix.target == 'full' && matrix.xdebug == 'false' && github.ref_name == 'master') }} + TAG_NAME: ${{ matrix.debian }}-${{ matrix.php }}${{ matrix.target == 'light' && '-light' || '' }}${{ matrix.xdebug && '-debug' || '' }}${{ github.ref_name != 'master' && '-dev' || '' }} + TAG_LATEST_ENABLED: ${{ (matrix.debian == 'bullseye' && matrix.target == 'full' && matrix.target == 'full' && matrix.xdebug == 'false' && github.ref_name == 'master') }} steps: - name: Prepare ${{ env.TAG_NAME }}:${{ matrix.platform }} @@ -149,7 +150,7 @@ jobs: DEBIAN=${{ matrix.debian }} PHP=${{ matrix.php }} JEEDOM_REPO=${{ env.JEEDOM_REPO }} - JEEDOM_VERSION=${{ matrix.jeedom }} + JEEDOM_VERSION=master_php${{ matrix.php }} XDEBUG=${{ matrix.xdebug }} platforms: linux/${{ matrix.platform }} cache-from: type=local,src=/tmp/.buildx-cache @@ -161,7 +162,7 @@ jobs: if: steps.buildJeedom.outcome != 'success' # some debug information in case of error run: | - echo "${{ matrix.debian }} PHP${{ matrix.php }} ${{ matrix.target }} branch ${{ matrix.jeedom }} debug ${{ matrix.xdebug }} has Errors! 🚀" >> $GITHUB_STEP_SUMMARY + echo "${{ matrix.debian }} PHP${{ matrix.php }} ${{ matrix.target }} branch master_php${{ matrix.php }} debug ${{ matrix.xdebug }} has Errors! 🚀" >> $GITHUB_STEP_SUMMARY echo "Cache: buildx-${{ runner.os }}-${{ matrix.platform }}-${{ matrix.debian }} hit? ${{ steps.cache.outputs.cache-hit }}" echo "Labels: ${{ steps.meta.outputs.labels }}" >> $GITHUB_STEP_SUMMARY exit 1 @@ -221,9 +222,9 @@ jobs: env: REGISTRY_IMAGE: pifou25/jeedom - TAG_NAME: ${{ matrix.debian }}-${{ matrix.php }}${{ matrix.target == 'light' && '-light' || '' }}${{ matrix.jeedom == 'beta' && '-beta' || '' }}${{ matrix.xdebug && '-debug' || '' }}${{ github.ref_name != 'master' && '-dev' || '' }} + TAG_NAME: ${{ matrix.debian }}-${{ matrix.php }}${{ matrix.target == 'light' && '-light' || '' }}${{ matrix.xdebug && '-debug' || '' }}${{ github.ref_name != 'master' && '-dev' || '' }} GHCR_NAME: ghcr.io/${{ secrets.DOCKER_USER }}/jeedom - TAG_LATEST_ENABLED: ${{ (matrix.debian == 'bullseye' && matrix.target == 'full' && matrix.jeedom == 'V4-stable' && matrix.target == 'full' && matrix.xdebug == 'false' && github.ref_name == 'master') }} + TAG_LATEST_ENABLED: ${{ (matrix.debian == 'bullseye' && matrix.target == 'full' && matrix.target == 'full' && matrix.xdebug == 'false' && github.ref_name == 'master') }} steps: - diff --git a/build/Dockerfile b/build/Dockerfile index 88786e1..d8b5377 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,45 +1,16 @@ -ARG DEBIAN=bullseye -ARG PHP=7.3 -ARG JEEDOM_REPO=jeedom/core - -# prepare PHP source with dependencies -FROM composer:2.7 as vendor - -ARG JEEDOM_REPO -ARG JEEDOM_VERSION=V4-stable -ENV JEEDOM_VERSION=${JEEDOM_VERSION} - -WORKDIR /app -# Download and extract PHP sources -ADD https://github.com/${JEEDOM_REPO}/archive/${JEEDOM_VERSION}.zip /tmp/jeedom.zip -RUN unzip -q /tmp/jeedom.zip -d /tmp/source/ && \ - find /tmp/source/ -maxdepth 1 -type d -name '*core*' -exec sh -c 'mv -T {} /app' {} \; && \ - rm /tmp/jeedom.zip && \ - rm -rf /app/vendor /app/install/.htaccess -COPY install.htaccess ./install/.htaccess - -# run composer for dependancies -RUN composer install \ - --no-interaction \ - --no-plugins \ - --no-scripts \ - --no-dev \ - --prefer-dist - - -# Build with 3 stages, 2 targets : +# Build with 3 stages, 2 targets : # first stage 'base' is common to 2 following targets # 'light_jeedom': no daemon, only apache+php # 'full_jeedom': standalone with all required daemons # # Debian version: buster / bullseye / bookworm -ARG DEBIAN -# PHP version required for bookworm is 8 minimum -ARG PHP +ARG DEBIAN=bullseye +# PHP version required for bookworm is 8.2 +# bullseye and buster : 7.3 +ARG PHP=7.3 FROM php:${PHP}-apache-${DEBIAN} as base ARG DEBIAN ARG PHP -ARG JEEDOM_REPO # optional XDEBUG arg to add xdebug packages and configuration ARG XDEBUG @@ -48,6 +19,10 @@ LABEL org.opencontainers.image.source https://github.com/pifou25/docker-jeedom LABEL org.opencontainers.artifact.description "Jeedom Home Automation in Docker" LABEL org.opencontainers.image.authors pifou25 +# repo: jeedom/core or pifou25/jeedom-core +ARG JEEDOM_REPO=jeedom/core +# branch name: V4-stable or beta +# or master_php7.3 master_php8.2 ARG JEEDOM_VERSION=V4-stable ENV JEEDOM_VERSION=${JEEDOM_VERSION} ENV MYSQL_JEEDOM_DATABASE=jeedom @@ -116,8 +91,18 @@ RUN install-php-extensions\ WORKDIR /var/www/html VOLUME /var/www/html -# copy PHP sources from previous stage -COPY --from=vendor app/ . + +# Download and extract PHP sources from $repo:$branch +ADD https://github.com/${JEEDOM_REPO}/archive/${JEEDOM_VERSION}.zip /tmp/jeedom.zip +RUN unzip -q /tmp/jeedom.zip -d /tmp/source/ && \ + find /tmp/source/ -maxdepth 1 -type d -name '*core*' -exec sh -c 'mv -T {} /var/www/html' {} \; && \ + rm /tmp/jeedom.zip && \ + rm -rf /app/vendor /app/install/.htaccess +COPY install.htaccess ./install/.htaccess + +# download & run composer for dependancies +COPY --from=composer/composer:latest-bin /composer /usr/bin/composer +RUN composer install --no-progress --no-interaction --no-dev # Change uid and gid of apache to docker user uid/gid - create /tmp/jeedom RUN usermod -u 1000 www-data \ @@ -129,7 +114,8 @@ RUN usermod -u 1000 www-data \ VOLUME /var/www/html/backup VOLUME /var/www/html/log -# install xdebug : check compatibility https://xdebug.org/docs/compat +# install xdebug-3.0.4 for php7.3 and 3.3.2 for php8.2 +# check https://xdebug.org/docs/compat COPY xdebug.ini /tmp/xdebug.ini RUN if [[ ${XDEBUG} == "true" ]] ; then \ pecl install redis-5.3.4 \ @@ -138,8 +124,6 @@ RUN if [[ ${XDEBUG} == "true" ]] ; then \ && mv /tmp/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini ; \ fi - -# # First final image: light Jeedom with /without xdebug # FROM base as light_jeedom @@ -175,7 +159,7 @@ RUN apt-get update && apt-get install --no-install-recommends --no-install-sugge supervisor \ && rm -rf /var/lib/apt/lists/* -# customization from official ${JEEDOM_REPO} repo +# customization from ${JEEDOM_REPO} repo COPY standalone/supervisord.conf /etc/supervisor/supervisord.conf COPY standalone/jeedom_my.cnf /etc/mysql/conf.d/jeedom_my.cnf ADD https://raw.githubusercontent.com/${JEEDOM_REPO}/${JEEDOM_VERSION}/install/apache_security /etc/apache2/conf-available/security.conf diff --git a/build/standalone/init.sh b/build/standalone/init.sh index 02c5a04..5ae549b 100644 --- a/build/standalone/init.sh +++ b/build/standalone/init.sh @@ -74,8 +74,7 @@ if [ ! -f "${WEBSERVER_HOME}/core/config/common.config.php" ]; then # changes for mysql socket instead of tcp for local use # sed -i "s/'host'/'unix_socket'/g" ${WEBSERVER_HOME}/core/config/common.config.php # sed -i "s/#HOST#/\/run\/mysqld\/mysqld.sock/g" ${WEBSERVER_HOME}/core/config/common.config.php - - + chmod 770 -R ${WEBSERVER_HOME} chown -R www-data:www-data ${WEBSERVER_HOME} mkdir -p /tmp/jeedom @@ -99,7 +98,6 @@ if [ ! -f "${WEBSERVER_HOME}/core/config/common.config.php" ]; then mysql_sql "CREATE USER '${MYSQL_JEEDOM_USER}'@'localhost' IDENTIFIED BY '${MYSQL_JEEDOM_PASSWD}';" mysql_sql "GRANT ALL PRIVILEGES ON ${MYSQL_JEEDOM_DATABASE}.* TO '${MYSQL_JEEDOM_USER}'@'localhost';" - log_info "jeedom clean install" php ${WEBSERVER_HOME}/install/install.php mode=force if [ $? -ne 0 ]; then