diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index 7f44379..0000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Docker NIGHTLY - -on: - workflow_dispatch: - schedule: - - cron: '30 2 * * *' - -env: - IMAGE_NAME: pimcore/pimcore - -jobs: - build-php: - name: "Build PHP images" - runs-on: ubuntu-latest - if: github.repository == 'pimcore/docker' - strategy: - matrix: - php: [ '8.0', '8.1' ] - distro: [ bullseye ] - target: [ fpm, debug, supervisord ] - - steps: - - uses: actions/checkout@v2 - - - name: Login to DockerHub Registry - run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin - - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.target }} - restore-keys: | - ${{ runner.os }}-buildx-${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.target }}- - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: 'amd64,arm64' - - - name: Set up Buildx - uses: docker/setup-buildx-action@v2 - - - name: Set Release Name - id: vars - run: | - DOCKER_PLATFORMS=linux/amd64,linux/arm64 - PHP_VERSION=${{ matrix.php }} - DEBIAN_VERSION="${{ matrix.distro }}" - VERSION="dev" - PHP_SUB_VERSION=$(docker run -i --rm php:${{ matrix.php }}-fpm-${{ matrix.distro }} php -r 'echo PHP_VERSION;') - - if [ "${{ matrix.target }}" = "fpm" ]; then - BASE_TAG="php${{ matrix.php }}" - BASE_TAG_DETAILED="php${PHP_SUB_VERSION}" - else - BASE_TAG="php${{ matrix.php }}-${{ matrix.target }}" - BASE_TAG_DETAILED="php${PHP_SUB_VERSION}-${{ matrix.target }}" - fi - - TAG="${BASE_TAG}-${VERSION}" - TAG_DETAILED="${BASE_TAG_DETAILED}-${VERSION}" - - TAGS="--tag ${IMAGE_NAME}:${TAG}" - TAGS="$TAGS --tag ${IMAGE_NAME}:${TAG_DETAILED}" - - if [ "${{ matrix.target }}" = "debug" ]; then - TAGS="$TAGS --tag ${IMAGE_NAME}:PHP${{ matrix.php }}-fpm-debug" - TAGS="$TAGS --tag ${IMAGE_NAME}:PHP${{ matrix.php }}-cli-debug" - elif [ "${{ matrix.target }}" = "fpm" ]; then - TAGS="$TAGS --tag ${IMAGE_NAME}:PHP${{ matrix.php }}-cli" - TAGS="$TAGS --tag ${IMAGE_NAME}:PHP${{ matrix.php }}-fpm" - elif [ "${{ matrix.target }}" = "supervisord" ]; then - TAGS="$TAGS --tag ${IMAGE_NAME}:PHP${{ matrix.php }}-supervisord" - fi - - echo ::set-output name=tag::${TAG} - - echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ - --target=pimcore_php_${{ matrix.target }} \ - --build-arg PHP_VERSION="${PHP_VERSION}" \ - --build-arg DEBIAN_VERSION="${DEBIAN_VERSION}" \ - --cache-from "type=local,src=/tmp/.buildx-cache" \ - --cache-to "type=local,dest=/tmp/.buildx-cache-new" \ - ${TAGS} . - - echo ${TAGS} - - - name: Build and push images - run: | - set -x; - - docker buildx build --output "type=image,push=true" ${{ steps.vars.outputs.buildx_args }} - docker buildx imagetools inspect ${IMAGE_NAME}:${{ steps.vars.outputs.tag }} - - - name: Move cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache - - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ed31f19..38705fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Docker RELEASE +name: Docker Build & Release on: workflow_dispatch: @@ -10,7 +10,8 @@ on: env: IMAGE_NAME: pimcore/pimcore - LATEST_TAG: main + LATEST_TAG: 1.0 + DEV_BRANCH: 1.x jobs: build-php: @@ -22,7 +23,7 @@ jobs: php: [ '8.0', '8.1' ] distro: [ bullseye ] target: [ fpm, debug, supervisord ] - tag: [ 'main' ] + tag: [ '1.x', '1.0' ] steps: - uses: actions/checkout@v3 @@ -54,7 +55,12 @@ jobs: DOCKER_PLATFORMS=linux/amd64,linux/arm64 PHP_VERSION=${{ matrix.php }} DEBIAN_VERSION="${{ matrix.distro }}" - VERSION="${{ matrix.tag }}" + VERSION="v${{ matrix.tag }}" + # for the latest dev branch we use "dev" as the version and not the name of the branch + if [ $DEV_BRANCH = "${{ matrix.tag }}" ]; then + VERSION="dev" + fi + PHP_SUB_VERSION=$(docker run -i --rm php:${{ matrix.php }}-fpm-${{ matrix.distro }} php -r 'echo PHP_VERSION;') if [ "${{ matrix.target }}" = "fpm" ]; then @@ -68,7 +74,6 @@ jobs: TAG="${BASE_TAG}-${VERSION}" TAG_DETAILED="${BASE_TAG_DETAILED}-${VERSION}" TAGS="--tag ${IMAGE_NAME}:${TAG}" - TAGS="$TAGS --tag ${IMAGE_NAME}:${TAG_DETAILED}" # Tag latest with Version build too @@ -76,6 +81,27 @@ jobs: TAGS="$TAGS --tag ${IMAGE_NAME}:${BASE_TAG}-latest" fi + # Create tag for major version + if [[ $VERSION =~ ^v[0-9]+.[0-9]+$ ]]; then + VERSION_MAJOR=${VERSION//.[0-9]/} + TAGS="$TAGS --tag ${IMAGE_NAME}:${BASE_TAG}-${VERSION_MAJOR}" + fi + + # BC Layer for tags before we introduced versioning + # They use uppercase "PHP" in tag name and always used the latest dev branch + if [ $DEV_BRANCH = "${{ matrix.tag }}" ]; then + if [ "${{ matrix.target }}" = "debug" ]; then + TAGS="$TAGS --tag ${IMAGE_NAME}:PHP${{ matrix.php }}-fpm-debug" + TAGS="$TAGS --tag ${IMAGE_NAME}:PHP${{ matrix.php }}-cli-debug" + elif [ "${{ matrix.target }}" = "fpm" ]; then + TAGS="$TAGS --tag ${IMAGE_NAME}:PHP${{ matrix.php }}-cli" + TAGS="$TAGS --tag ${IMAGE_NAME}:PHP${{ matrix.php }}-fpm" + elif [ "${{ matrix.target }}" = "supervisord" ]; then + TAGS="$TAGS --tag ${IMAGE_NAME}:PHP${{ matrix.php }}-supervisord" + fi + fi + + echo ::set-output name=tag::${TAG} echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ diff --git a/README.md b/README.md index 7d4fa96..25f4ac6 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,46 @@ It doesn't include the Pimcore software itself, it just provides an environment of Pimcore, so that you can leverage the full functionality. You can either use this image directly by mounting Pimcore into the container, or as a template for your customized - ready-to-deploy images. As a starting point please see [example docker-compose configuration](https://github.com/pimcore/skeleton/blob/HEAD/docker-compose.yaml). -## Supported tags and respective Dockerfile links -- PHP8.0 - - fpm (`pimcore/pimcore:php8.0-bullseye-fpm`) - - debug (`pimcore/pimcore:php8.0-bullseye-debug`) - with xdebug enabled - - supervisord (`pimcore/pimcore:php8.0-bullseye-supervisord`) -- PHP8.1 - - fpm (`pimcore/pimcore:php8.1-bullseye-fpm`) - - debug (`pimcore/pimcore:php8.1-bullseye-debug`) - with xdebug enabled - - supervisord (`pimcore/pimcore:php8.1-bullseye-supervisord`) - \ No newline at end of file +## Image flavors +We're providing 3 different image flavors: +- PHP image for FPM and CLI (e.g. `php8.1-latest`) +- PHP debug image based on PHP image above, including preconfigured Xdebug for FPM and CLI (e.g. `php8.1-debug-latest`) +- Supervisord image based on PHP image above, for cron & queue processing (e.g. `php8.1-supervisord-latest`) + +## Versioning +Our images are versioned using a version-suffix staring with `-v` following SemVer. +With that we're able to allow smooth upgrades, breaking changes are only delivered with major versions. +Additionally we're offering 2 special tag suffixes: +- `-latest` always points to the latest available tag (recommended for local development) +- `-dev` always points to the work in progress + +We're also offering special tags for specific PHP versions, e.g. `php8.1.11-v1.0`. + +## Examples + +### PHP images +```text +php8.1-latest # always use the latest PHP 8.1 image +php8.1-v1 # always point to the latest minor version of v1 +php8.1-v1.0 # pin to specific image version, always using the latest bugfixes from PHP 8.1 +php8.1.11-v1.0 # pin to a specific PHP version & image version +php8.1-dev # development image (build from the default branch) +``` + +### PHP Debug images +Same as PHP images, but using `-debug` after the PHP version: +```text +php8.1-debug-latest +php8.1-debug-v1 +... +``` + +### Supervisord +Same as PHP images, but using `-supervisor` after the PHP version: +```text +php8.1-supervisor-latest +php8.1-supervisor-v1 +... +``` \ No newline at end of file