From ae2c8d09553905fdfa77abb92d96cb9bdd5033af Mon Sep 17 00:00:00 2001 From: Hannes Giesenow Date: Tue, 19 Dec 2023 11:56:05 +0100 Subject: [PATCH] Adjusted path in Dockerfile, Changed branch name --- .github/workflows/docker.yml | 4 ++-- Dockerfile | 17 +++++++++-------- README.md | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b3199da3631..b829d7e6ac2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,7 +5,7 @@ on: tags: - "v*.*.*" branches: - - "main" + - "master" env: REGISTRY: ghcr.io @@ -61,7 +61,7 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LOWER }} tags: | - type=edge,branch=main,suffix=${{ matrix.php-suffix }} + type=edge,branch=master,suffix=${{ matrix.php-suffix }} type=semver,pattern={{version}},suffix=${{ matrix.php-suffix }} type=semver,pattern={{major}}.{{minor}},suffix=${{ matrix.php-suffix }} type=semver,pattern={{major}},suffix=${{ matrix.php-suffix }} diff --git a/Dockerfile b/Dockerfile index cefb3cb554b..0531c5ee887 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,20 +16,21 @@ FROM php:${PHP_VERSION}-cli-alpine${ALPINE_VERSION} as base COPY --from=composer/composer:2-bin /composer /usr/local/bin/composer FROM base as vendor -WORKDIR /var/www -COPY composer.json /var/www/composer.json +COPY composer.json /fixer/composer.json +WORKDIR /fixer RUN composer install --prefer-dist --no-dev --optimize-autoloader --no-scripts FROM php:${PHP_VERSION}-cli-alpine${ALPINE_VERSION} as dist -WORKDIR /var/www -RUN rmdir /var/www/html -COPY src /usr/local/bin/src -COPY php-cs-fixer /usr/local/bin/php-cs-fixer +RUN mkdir /code +WORKDIR /code +COPY src /fixer/src +COPY php-cs-fixer /fixer/php-cs-fixer # Only take the dependencies (not composer itself) into the container -COPY --from=vendor /var/www/vendor /usr/local/bin/vendor +COPY --from=vendor /fixer/vendor /fixer/vendor +RUN ln -s /fixer/php-cs-fixer /usr/local/bin/php-cs-fixer ENTRYPOINT ["/usr/local/bin/php-cs-fixer"] -FROM php:${PHP_VERSION}-cli-alpine${ALPINE_VERSION} as dev +FROM base as dev ARG DOCKER_USER_ID ARG DOCKER_GROUP_ID ARG PHP_XDEBUG_VERSION diff --git a/README.md b/README.md index a9113d8df7e..aac909afb98 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ projects. This tool does not only detect them, but also fixes them for you. You can take a ready built docker image to run ``php-cs-fixer``. ```console -docker run -v $(pwd):/var/www ghcr.io/php-cs-fixer/php-cs-fixer:latest fix src +docker run -v $(pwd):/code ghcr.io/php-cs-fixer/php-cs-fixer:latest fix src ``` or integrate as check into Gitlab CI like this: