Skip to content

Commit

Permalink
feat: use php-named branch
Browse files Browse the repository at this point in the history
master_phpx.x branch name from pifou25/jeedom-core
  • Loading branch information
pifou25 committed May 4, 2024
1 parent 1667382 commit a235efc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 73 deletions.
47 changes: 11 additions & 36 deletions .github/workflows/buildx-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- 'master'
- 'develop'
- 'feature/php_versions'

# no concurrency, cancel previous running workflow
concurrency:
Expand Down Expand Up @@ -40,36 +41,23 @@ jobs:
strategy:
fail-fast: false
matrix:
debian: [buster, bullseye, bookworm]
php: [7.3, 8.0, 8.2]
debian: [bullseye, bookworm]
php: [7.3, 8.2]
# linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
platform: [amd64, arm64, arm/v6, arm/v7]
jeedom: ["V4-stable", "beta"]
# jeedom: ["V4-stable", "beta"]
target: ["light", "full"]
xdebug: [true, false]
exclude:
# exclude Jeedom beta on every buster, not supported
- debian: "buster"
jeedom: "beta"
# exclude Jeedom debug on every buster, useless
- debian: "buster"
xdebug: false
# exclude php version for each debian
- debian: buster
php: 8.0
- debian: buster
php: 8.2
- debian: bullseye
php: 8.2
- debian: bookworm
php: 7.3
- debian: bookworm
php: 8.0

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 }}
Expand Down Expand Up @@ -149,7 +137,7 @@ jobs:
DEBIAN=${{ matrix.debian }}
PHP=${{ matrix.php }}
JEEDOM_REPO=pifou25/jeedom-core
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
Expand All @@ -161,7 +149,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
Expand Down Expand Up @@ -201,33 +189,20 @@ jobs:
matrix:
debian: [buster, bullseye, bookworm]
php: [7.3, 8.0, 8.2]
jeedom: ["V4-stable", "beta"]
# jeedom: ["V4-stable", "beta"]
target: ["light", "full"]
xdebug: [true, false]
exclude:
# exclude Jeedom beta on every buster, not supported
- debian: "buster"
jeedom: "beta"
# exclude Jeedom debug on every buster, useless
- debian: "buster"
xdebug: false
# exclude php version for each debian
- debian: buster
php: 8.0
- debian: buster
php: 8.2
- debian: bullseye
php: 8.2
- debian: bookworm
php: 7.3
- debian: bookworm
php: 8.0

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:
-
Expand Down
64 changes: 27 additions & 37 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -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=bullseye
# PHP version required for bookworm is 8 minimum
# 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

Expand All @@ -48,8 +19,13 @@ 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}
# dont try another value :
ARG WEBSERVER_HOME=/var/www/html
ENV WEBSERVER_HOME=${WEBSERVER_HOME}
ENV MYSQL_JEEDOM_DATABASE=jeedom
Expand All @@ -58,7 +34,7 @@ ENV MYSQL_JEEDOM_USER=jeedom
# ENV MYSQL_ROOT_PASSWORD
ENV DEBIAN_FRONTEND=noninteractive

LABEL com.jeedom.version="Jeedom ${JEEDOM_VERSION} for Debian ${DEBIAN} + PHP ${PHP}"
LABEL com.jeedom.version="${JEEDOM_REPO}:${JEEDOM_VERSION} for ${DEBIAN}:${PHP}"

# add motd & bashrc - link sh to bash for Docker Desktop
# add sudo for www-data
Expand Down Expand Up @@ -120,8 +96,18 @@ RUN sed -ri -e "s!/var/www/html!${WEBSERVER_HOME}!g" /etc/apache2/sites-availabl

WORKDIR ${WEBSERVER_HOME}
VOLUME ${WEBSERVER_HOME}
# copy PHP sources from previous stage
COPY --from=vendor app/ ${WEBSERVER_HOME}

# 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/ && \

Check failure on line 102 in build/Dockerfile

View workflow job for this annotation

GitHub Actions / initStep

SC2156 warning: Injecting filenames is fragile and insecure. Use parameters.
find /tmp/source/ -maxdepth 1 -type d -name '*core*' -exec sh -c 'mv -T {} ${WEBSERVER_HOME}' {} \; && \
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 \
Expand All @@ -143,8 +129,11 @@ RUN if [[ -N "$XDEBUG" ]] ; 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
# the mysql hostname is another environment variable
ENV MYSQL_HOST=db

# Healthcheck for the 'light' image, just check if apache is running
Expand All @@ -153,8 +142,9 @@ HEALTHCHECK --interval=90s --timeout=3s --retries=3 --start-period=120s \
COPY --chmod=0775 init.sh /root/init.sh
CMD ["/root/init.sh"]


#
# Second final image: full standalone
#
FROM base as full_jeedom
ARG JEEDOM_REPO
# localhost didn't work for mysql, should try 127.0.0.1
Expand All @@ -174,7 +164,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
Expand Down

0 comments on commit a235efc

Please sign in to comment.