Add Docker on prefixed/downgraded version only (#6368)

* move docker build to prefixed & downgraded version

* [Docker] do not scope, use existing composer dump
This commit is contained in:
Tomas Votruba 2021-05-06 13:24:32 +02:00 committed by GitHub
parent 692d9b3d19
commit aca76ddc2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 3 additions and 16 deletions

View File

@ -10,7 +10,6 @@ phpstan.neon
rector.php
phpunit.xml
ecs.php
changelog-linker.php
phpstan-for-rector.neon
LICENSE

View File

@ -15,7 +15,7 @@ env:
jobs:
publish_images:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:

View File

@ -31,23 +31,11 @@ RUN apt-get update && apt-get install -y \
COPY --from=composer:2.0.9 /usr/bin/composer /usr/bin/composer
ENV COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_MEMORY_LIMIT=-1 COMPOSER_NO_INTERACTION=1
# Run php-scoper, results go to /scoped
RUN wget https://github.com/humbug/php-scoper/releases/download/0.14.0/php-scoper.phar -N --no-verbose
# This is to make parsing version possible
COPY .git .git
# First copy composer.json only to leverage the build cache (as long as not git-committing)
COPY composer.json composer.json
RUN composer install --no-dev --ansi
# Add source and generate full autoloader
# Add source
COPY . .
RUN composer dump-autoload --classmap-authoritative --no-dev
RUN rm -f "phpstan-for-rector.neon" \
&& php -d memory_limit=-1 php-scoper.phar add-prefix preload.php bin config packages rules src templates vendor composer.json --output-dir /scoped --config scoper.php \
&& composer dump-autoload --optimize --classmap-authoritative --no-dev --working-dir /scoped
# Build runtime image
FROM base as rector
@ -63,7 +51,7 @@ ENTRYPOINT [ "rector" ]
VOLUME ["/project"]
WORKDIR "/project"
COPY --from=build /scoped /rector
COPY --from=build . /rector
RUN chmod +x /rector/bin/rector
RUN mkdir -p /tmp/opcache \