CircleCI-Public / cimg-php

The CircleCI PHP Docker image. Based on the `cimg/base` image.
https://circleci.com/developer/images/image/cimg/php
MIT License
12 stars 16 forks source link

Allow specifying node version #81

Closed mksplg closed 4 years ago

mksplg commented 4 years ago

The *-node images have node preinstalled. We are using node to build some client-side JS code. Sometimes large version jumps break the build process.

To make builds more deterministic and avoid breaking changes it would help if we could specify the installed node version, e.g. by extending the tag to inclde the version 7.2-node-12.

As node is only used during build we are not too picky on the specific version but would like to avoid unexpected changes in the major version. AFAIK using node during build alongside PHP apps is a common pattern used for example in laravel.

FelicianoTech commented 4 years ago

Hi,

Thank you for bringing this up. My question for you is, are you using the legacy PHP Convenience Image or the next-gen one? The legacy one (with the name circleci/php) works differently than the next-gen one (with the name cimg/php). The next-gen version is what this GitHub repository is for.

The Node variant images for legacy Convenience Images are using the latest LTS version of Node.js. This was Node.js v12 until just recently. They are built every 24 hours and when the LTS version changes, most of the images will automatically upgrade.

For next-gen Node variant images, they also use the latest LTS version of Node.js. The difference here is that they get "assigned" the LTS version of Node.js that they will use when the image is created. It then won't change. So 6 months from now, an image will continue to have that same version of Node.js in it.

Updating to a newer PHP release, say PHP v7.2 to v7.3 may have a slightly newer version of Node.js in that new image. So the Node.js version only changes when you change through image tags. If you choose a full SemVer tag such as php:7.3.0, then nothing in the image will change.

We won't be creating new tags specific to Node.js versions as you requested but I hope the above helps provide context on how you can use our images.

Lastly, you can always manually control the version of Node.js you want to use, outside of our images, by using the CircleCI Node.js Orb.

mksplg commented 4 years ago

Hi, thanks for the detailed answer. I was referring to the next-gen image in this repositry. This came up as we are looking in to switching to this image and realised the node version in cimg/php-7.3 is lower than circleci/php-7.3.

I think this works for us. Since the node version is pinned to the image version we only have to worry about it when upgrading the image. In this case we have to test the build process more thoroughly anyway.