Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed PHP version to 8.1 for older composer versions #314

Conversation

InvensoGroup
Copy link

composer:2.3 and composer:2.4 are now fixed to PHP 8.1

base container php:8-alpine is updated to latest PHP version 8.3 which is not yet supported by all packages
use fixed PHP version for older composer version for compatibility

composer:2.3 and composer:2.4 are now fixed to PHP 8.1
@InvensoGroup InvensoGroup changed the title Fix PHP version to 8.1 for older composer versions Fixed PHP version to 8.1 for older composer versions Nov 29, 2023
2.3/Dockerfile Outdated Show resolved Hide resolved
2.4/Dockerfile Outdated Show resolved Hide resolved
don't exclude future patch updates
@alcohol
Copy link
Member

alcohol commented Dec 1, 2023

Is there a reason you went for 8.1 instead of 8.2 ?

@alcohol
Copy link
Member

alcohol commented Dec 1, 2023

Actually, this change is not necessary. Composer (even the older versions) works just fine on 8.3

@alcohol alcohol closed this Dec 1, 2023
@InvensoGroup
Copy link
Author

Hi, the reason I raised this pull request is that PHP:8-apline was updated to version 8.3

We use the composer as a build only (standalone) without installing it in the production container

After the update we encountered issues because our source code is supporting PHP 8.1
Since composer 2.3 and 2.4 are older versions and PHP8.3 was not out by that time I was thinking it could be fixed to older versions of PHP

If PHP8.3 is required users can use the latest composer container

I've put a code example below to show how we use the containers
We first build with composer and than copy the vendor to the production container without having composer in the production build.

FROM composer:2 AS build

RUN set -eux; \
  composer dump-autoload --classmap-authoritative --no-dev; \
  composer install --prefer-dist --no-dev --no-scripts --no-progress --ignore-platform-req=ext-xdebug; \
  composer clear-cache; 



FROM php:8.1 AS production

WORKDIR /srv
COPY --from=build /srv/vensor/ ./vendor

@alcohol
Copy link
Member

alcohol commented Dec 1, 2023

@alcohol
Copy link
Member

alcohol commented Dec 1, 2023

You could do the following:

FROM php:8.1 AS build

COPY --from=composer/composer:latest-bin /usr/bin/composer /usr/bin/composer

RUN set -eux; \
  composer dump-autoload --classmap-authoritative --no-dev; \
  composer install --prefer-dist --no-dev --no-scripts --no-progress --ignore-platform-req=ext-xdebug; \
  composer clear-cache; 

FROM php:8.1 AS production

WORKDIR /srv
COPY --from=build /srv/vendor/ ./vendor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants