Skip to content

Commit

Permalink
feat: try previous minor build definition (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice authored Nov 25, 2024
1 parent 9aaf2a6 commit b549c3f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ ARG DISTRO=focal
#--------------------------------------
# base images
#--------------------------------------
FROM ghcr.io/containerbase/ubuntu:20.04@sha256:8e5c4f0285ecbb4ead070431d29b576a530d3166df73ec44affc1cd27555141b as build-focal
FROM ghcr.io/containerbase/ubuntu:22.04@sha256:0e5e4a57c2499249aafc3b40fcd541e9a456aab7296681a3994d631587203f97 as build-jammy
FROM ghcr.io/containerbase/ubuntu:20.04@sha256:8e5c4f0285ecbb4ead070431d29b576a530d3166df73ec44affc1cd27555141b AS build-focal
FROM ghcr.io/containerbase/ubuntu:22.04@sha256:0e5e4a57c2499249aafc3b40fcd541e9a456aab7296681a3994d631587203f97 AS build-jammy


#--------------------------------------
# builder images
#--------------------------------------
FROM build-${DISTRO} as builder
FROM build-${DISTRO} AS builder

ARG APT_PROXY

Expand Down
21 changes: 16 additions & 5 deletions bin/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,40 +29,51 @@ function check_semver () {
}

if [[ ! -f "/usr/local/share/php-build/definitions/${VERSION}" ]]; then
echo "Missing build definition for ${VERSION}. Trying to find older patch build definition"
echo "Missing build definition for ${VERSION}. Trying to find older build definition."
check_semver "${VERSION}"
if [[ ! "${MAJOR}" || ! "${MINOR}" || ! "${PATCH}" ]]; then
echo Invalid version: "${TOOL_VERSION}" >&2
exit 1
fi
oldVersion=$(find /usr/local/share/php-build/definitions -type f -name "${MAJOR}.${MINOR}.*" -printf '%f\n' | sort --version-sort -r | head -n 1)

oldVersion=$(find /usr/local/share/php-build/definitions -type f -name "${MAJOR}.${MINOR}.*" -printf '%f\n' | sort --version-sort -r | head -n 1)
if [[ -z $oldVersion ]]; then
echo "No usable definition found" >&2
exit 1
oldVersion=$(find /usr/local/share/php-build/definitions -type f -name "${MAJOR}.$((MINOR-1)).*" -printf '%f\n' | sort --version-sort -r | head -n 1)
if [[ -z $oldVersion ]]; then
echo "No usable definition found" >&2
exit 1
fi
fi

echo "Using $oldVersion"

cp "/usr/local/share/php-build/definitions/$oldVersion" "/usr/local/share/php-build/definitions/${VERSION}"
sed -i "s/php-${oldVersion}/php-${VERSION}/" "/usr/local/share/php-build/definitions/${VERSION}"
cat "/usr/local/share/php-build/definitions/${VERSION}"
fi

# disable xdebug
sed 's/install_xdebug/#install_xdebug/' -i "/usr/local/share/php-build/definitions/${VERSION}"

echo -----------------------------------------------------
echo "Using definition /usr/local/share/php-build/definitions/${VERSION}"
echo -----------------------------------------------------
cat "/usr/local/share/php-build/definitions/${VERSION}"
echo -----------------------------------------------------

# https://github.com/php-build/php-build/blob/6530e7501ccc758928d5510813dc3f5fbdc87419/man/php-build.1.ronn#environment
# https://github.com/php-build/php-build/issues/564
export PHP_BUILD_CONFIGURE_OPTS="--disable-intl --disable-cgi --disable-fpm --disable-phpdbg --disable-shared --enable-static" PHP_BUILD_XDEBUG_ENABLE=off

echo "Building ${NAME} ${VERSION} for ${CODENAME}"
echo -----------------------------------------------------
php-build ${BUILD_ARGS} "${VERSION}" "/usr/local/${NAME}/${VERSION}"

echo -----------------------------------------------------
"/usr/local/${NAME}/${VERSION}/bin/php" --version

file "/usr/local/${NAME}/${VERSION}/bin/php"
#ldd "/usr/local/${NAME}/${VERSION}/bin/php"

echo -----------------------------------------------------
echo "Compressing ${NAME} ${VERSION} for ${CODENAME}-${ARCH}"
tar -cJf "/cache/${NAME}-${VERSION}-${CODENAME}-${ARCH}.tar.xz" -C /usr/local/${NAME} "${VERSION}"
10 changes: 7 additions & 3 deletions renovate.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
# makes lint happy
FROM scratch

# EOL: 2024-11-25
# EOL: 2025-12-31
# renovate: datasource=docker depName=php versioning=docker
ENV PHP_VERSION=8.1.30

# EOL: 2025-12-08
# EOL: 2026-12-31
# renovate: datasource=docker depName=php versioning=docker
ENV PHP_VERSION=8.2.25

# EOL: 2026-11-23
# EOL: 2027-12-31
# renovate: datasource=docker depName=php versioning=docker
ENV PHP_VERSION=8.3.13

# EOL: 2028-12-31
# renovate: datasource=docker depName=php versioning=docker
ENV PHP_VERSION=8.4.1

0 comments on commit b549c3f

Please sign in to comment.