mirror of https://github.com/rectorphp/rector.git
[docker] remove docker building from release repository (#614)
This commit is contained in:
parent
a8b01f217b
commit
e3f20c1fb6
|
@ -1,27 +0,0 @@
|
||||||
################################################
|
|
||||||
## Docker image used for profiling Rector ##
|
|
||||||
################################################
|
|
||||||
|
|
||||||
ARG PHP_VERSION=8.0
|
|
||||||
|
|
||||||
FROM rector/rector:php${PHP_VERSION}
|
|
||||||
|
|
||||||
# Install php extensions
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
wget \
|
|
||||||
gnupg2
|
|
||||||
|
|
||||||
# Setup blackfire repo
|
|
||||||
RUN wget -q -O - https://packages.blackfire.io/gpg.key | apt-key add -
|
|
||||||
RUN echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list
|
|
||||||
|
|
||||||
# Install blackfire php extensions
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
blackfire-php
|
|
||||||
|
|
||||||
# Install blackfire cli tool
|
|
||||||
RUN mkdir -p /tmp/blackfire \
|
|
||||||
&& architecture=$(case $(uname -m) in i386 | i686 | x86) echo "i386" ;; x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) \
|
|
||||||
&& curl -A "Docker" -L https://blackfire.io/api/v1/releases/client/linux/$architecture | tar zxp -C /tmp/blackfire \
|
|
||||||
&& mv /tmp/blackfire/blackfire /usr/bin/blackfire \
|
|
||||||
&& rm -Rf /tmp/blackfire
|
|
|
@ -1,34 +0,0 @@
|
||||||
## Docker image for Blackfire profiling
|
|
||||||
|
|
||||||
### Build
|
|
||||||
|
|
||||||
Builds image with `rector-blackfire` tag.
|
|
||||||
|
|
||||||
```
|
|
||||||
docker build . --tag rector-blackfire --file .docker/php-blackfire/Dockerfile
|
|
||||||
```
|
|
||||||
|
|
||||||
You can use `--build-arg PHP_VERSION=7.4` to build with specific PHP version. Supported versions are: 7.3, 7.4, 8.0
|
|
||||||
|
|
||||||
|
|
||||||
### Prepare
|
|
||||||
|
|
||||||
These variables must be set on host to pass them into container (obtain values at [blackfire.io](https://blackfire.io)):
|
|
||||||
```
|
|
||||||
export BLACKFIRE_CLIENT_ID=""
|
|
||||||
export BLACKFIRE_CLIENT_TOKEN=""
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
|
|
||||||
Get into container:
|
|
||||||
|
|
||||||
```
|
|
||||||
docker run --entrypoint="" -it --rm -e BLACKFIRE_CLIENT_ID -e BLACKFIRE_CLIENT_TOKEN -v $(pwd):/rector rector-blackfire bash
|
|
||||||
```
|
|
||||||
|
|
||||||
Once in container, you can start profiling:
|
|
||||||
```
|
|
||||||
blackfire run php bin/rector <args..>
|
|
||||||
```
|
|
|
@ -1,11 +0,0 @@
|
||||||
################################################
|
|
||||||
## Docker image used for debugging Rector ##
|
|
||||||
################################################
|
|
||||||
|
|
||||||
ARG PHP_VERSION=8.0
|
|
||||||
|
|
||||||
FROM rector/rector:php${PHP_VERSION}
|
|
||||||
|
|
||||||
RUN pecl install xdebug
|
|
||||||
|
|
||||||
COPY .docker/php-xdebug/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
|
|
|
@ -1,26 +0,0 @@
|
||||||
## Docker image for Xdebug debugging
|
|
||||||
|
|
||||||
### Build
|
|
||||||
|
|
||||||
Builds image with `rector-xdebug` tag.
|
|
||||||
|
|
||||||
```shell
|
|
||||||
docker build . --tag rector-xdebug --file .docker/php-xdebug/Dockerfile
|
|
||||||
```
|
|
||||||
|
|
||||||
You can use `--build-arg PHP_VERSION=7.4` to build with specific PHP version. Supported versions are: 7.3, 7.4, 8.0
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
|
|
||||||
Get into container (change ip address):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
docker run -it --rm \
|
|
||||||
--entrypoint="" \
|
|
||||||
--volume $(pwd):/rector \
|
|
||||||
--env XDEBUG_CONFIG="client_host=172.16.165.1" \
|
|
||||||
--env PHP_IDE_CONFIG="serverName=rector" \
|
|
||||||
rector-xdebug bash
|
|
||||||
```
|
|
||||||
|
|
||||||
**Do not forget to run rector binary with `--xdebug` option.**
|
|
|
@ -1,5 +0,0 @@
|
||||||
[xdebug]
|
|
||||||
zend_extension = "/usr/local/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so"
|
|
||||||
xdebug.mode = debug
|
|
||||||
xdebug.client_port = 9003
|
|
||||||
xdebug.start_with_request = yes
|
|
|
@ -1,10 +0,0 @@
|
||||||
[opcache]
|
|
||||||
opcache.memory_consumption=128
|
|
||||||
opcache.interned_strings_buffer=8
|
|
||||||
opcache.max_accelerated_files=4000
|
|
||||||
opcache.revalidate_freq=60
|
|
||||||
opcache.fast_shutdown=1
|
|
||||||
opcache.enable_cli=1
|
|
||||||
opcache.enable=1
|
|
||||||
opcache.file_cache='/tmp/opcache'
|
|
||||||
opcache.file_update_protection=0
|
|
|
@ -1,28 +0,0 @@
|
||||||
*~
|
|
||||||
.DS_Store
|
|
||||||
.idea/
|
|
||||||
|
|
||||||
.env
|
|
||||||
.editorconfig
|
|
||||||
.phpstorm.meta.php
|
|
||||||
|
|
||||||
phpstan.neon
|
|
||||||
rector.php
|
|
||||||
phpunit.xml
|
|
||||||
ecs.php
|
|
||||||
|
|
||||||
LICENSE
|
|
||||||
|
|
||||||
.gitattributes
|
|
||||||
.gitignore
|
|
||||||
|
|
||||||
*.md
|
|
||||||
|
|
||||||
.dockerignore
|
|
||||||
Dockerfile
|
|
||||||
docker-compose.yml
|
|
||||||
docker-compose.dist.yml
|
|
||||||
|
|
||||||
/docs
|
|
||||||
|
|
||||||
*.phar
|
|
|
@ -17,12 +17,9 @@ CODE_OF_CONDUCT.md export-ignore
|
||||||
# exclude only root dirs, otherwise nette/utils is removed - see https://github.com/TomasVotruba/tomasvotruba.com/pull/1197/checks?check_run_id=2577329283
|
# exclude only root dirs, otherwise nette/utils is removed - see https://github.com/TomasVotruba/tomasvotruba.com/pull/1197/checks?check_run_id=2577329283
|
||||||
/stubs export-ignore
|
/stubs export-ignore
|
||||||
|
|
||||||
Dockerfile export-ignore
|
|
||||||
docs/images export-ignore
|
docs/images export-ignore
|
||||||
.docker export-ignore
|
|
||||||
.github export-ignore
|
.github export-ignore
|
||||||
/e2e export-ignore
|
/e2e export-ignore
|
||||||
.dockerignore export-ignore
|
|
||||||
|
|
||||||
# testing Windows spaces - https://help.github.com/en/github/using-git/configuring-git-to-handle-line-endings
|
# testing Windows spaces - https://help.github.com/en/github/using-git/configuring-git-to-handle-line-endings
|
||||||
packages/better-php-doc-parser/tests/PhpDocInfo/PhpDocInfoPrinter/FixtureBasic/with_spac.txt text eol=crlf
|
packages/better-php-doc-parser/tests/PhpDocInfo/PhpDocInfoPrinter/FixtureBasic/with_spac.txt text eol=crlf
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
name: Build docker images
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
# Publish `main` as Docker `latest` image.
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
# Publish `v1.2.3` tags as releases.
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
env:
|
|
||||||
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
|
|
||||||
COMPOSER_ROOT_VERSION: "dev-main"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish_images:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Build images
|
|
||||||
run: |
|
|
||||||
DOCKER_TAGS=""
|
|
||||||
|
|
||||||
# Pull tag and branch from github.ref, which is either refs/heads/... or refs/tags/...
|
|
||||||
TAG=$(echo "${{ github.ref }}" | sed -e '/refs\/tags\//!d; s,refs/.*/v\?\(.*\),\1,')
|
|
||||||
BRANCH=$(echo "${{ github.ref }}" | sed -e '/refs\/heads\//!d; s,refs/.*/\(.*\),\1,')
|
|
||||||
|
|
||||||
if [ "main" == "$BRANCH" ]; then
|
|
||||||
DOCKER_TAGS="$DOCKER_TAGS latest"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z "$TAG" ]; then
|
|
||||||
DOCKER_TAGS="$DOCKER_TAGS $TAG"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Image will be tagged with: $DOCKER_TAGS"
|
|
||||||
|
|
||||||
DOCKER_TAG_ARG=""
|
|
||||||
for ARG in $DOCKER_TAGS; do
|
|
||||||
DOCKER_TAG_ARG="$DOCKER_TAG_ARG --tag rector/rector:$ARG"
|
|
||||||
done
|
|
||||||
|
|
||||||
docker buildx create --name builder-php8 --use
|
|
||||||
docker buildx build \
|
|
||||||
--progress plain \
|
|
||||||
--cache-from=rector/rector:build-cache-php8 \
|
|
||||||
--cache-to=type=registry,ref=rector/rector:build-cache-php8,mode=max,push=true \
|
|
||||||
--target rector \
|
|
||||||
--push \
|
|
||||||
$DOCKER_TAG_ARG \
|
|
||||||
--platform linux/amd64,linux/arm64 \
|
|
||||||
--build-arg PHP_VERSION=8 .
|
|
|
@ -1,58 +0,0 @@
|
||||||
ARG PHP_VERSION=8.0
|
|
||||||
FROM php:${PHP_VERSION}-cli as base
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
libzip4 \
|
|
||||||
libicu63 \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
FROM base as build
|
|
||||||
|
|
||||||
WORKDIR /rector
|
|
||||||
|
|
||||||
# Install php extensions
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
g++ \
|
|
||||||
git \
|
|
||||||
libicu-dev \
|
|
||||||
libzip-dev \
|
|
||||||
unzip \
|
|
||||||
wget \
|
|
||||||
zip \
|
|
||||||
&& pecl -q install \
|
|
||||||
zip \
|
|
||||||
&& docker-php-ext-configure intl \
|
|
||||||
&& docker-php-ext-configure opcache --enable-opcache \
|
|
||||||
&& docker-php-ext-install \
|
|
||||||
intl \
|
|
||||||
opcache \
|
|
||||||
zip
|
|
||||||
|
|
||||||
# Add source
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Build runtime image
|
|
||||||
FROM base as rector
|
|
||||||
|
|
||||||
COPY --from=build /usr/local/lib/php /usr/local/lib/php
|
|
||||||
COPY --from=build /usr/local/etc/php /usr/local/etc/php
|
|
||||||
COPY .docker/php/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
|
|
||||||
|
|
||||||
ENV PATH /rector/bin:$PATH
|
|
||||||
|
|
||||||
# Add source
|
|
||||||
COPY . /rector
|
|
||||||
|
|
||||||
ENTRYPOINT [ "rector" ]
|
|
||||||
|
|
||||||
VOLUME ["/project"]
|
|
||||||
WORKDIR "/project"
|
|
||||||
|
|
||||||
RUN mkdir -p /tmp/opcache
|
|
||||||
|
|
||||||
RUN chmod +x /rector/bin/rector
|
|
||||||
RUN /rector/bin/rector list
|
|
||||||
|
|
||||||
RUN mkdir -p /tmp/opcache \
|
|
||||||
&& /rector/bin/rector list \
|
|
||||||
&& chmod 777 -R /tmp
|
|
|
@ -1,43 +0,0 @@
|
||||||
# How to Run Rector in Docker
|
|
||||||
|
|
||||||
You can run Rector on your project using Docker.
|
|
||||||
To make sure you are running latest version, use `docker pull rector/rector`.
|
|
||||||
|
|
||||||
*Note that Rector inside Docker expects your application in `/project` directory - it is mounted via volume from the current directory (`$pwd`).*
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker run --rm -v $(pwd):/project rector/rector:latest process src --dry-run
|
|
||||||
```
|
|
||||||
|
|
||||||
Using `rector.php` config:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker run --rm -v $(pwd):/project rector/rector:latest process src \
|
|
||||||
--config rector.php \
|
|
||||||
--dry-run
|
|
||||||
```
|
|
||||||
|
|
||||||
## Multiple PHP versions supported
|
|
||||||
|
|
||||||
You should always use image with PHP version closest to your project's.
|
|
||||||
|
|
||||||
Rector Docker images supports PHP versions 7.3, 7.4, 8.0.
|
|
||||||
|
|
||||||
```
|
|
||||||
## Using with specific tagged version of Rector
|
|
||||||
rector/rector:0.9.32-php7.3
|
|
||||||
rector/rector:0.9.32-php7.4
|
|
||||||
rector/rector:0.9.32-php8.0
|
|
||||||
|
|
||||||
## Using latest release
|
|
||||||
rector/rector:php7.3 # same as rector/rector:latest-php7.3
|
|
||||||
rector/rector:php7.4 # same as rector/rector:latest-php7.4
|
|
||||||
rector/rector:php8.0 # same as rector/rector:latest-php8.0
|
|
||||||
```
|
|
||||||
|
|
||||||
## Permissions issues
|
|
||||||
|
|
||||||
If you run into issues with `permission denied` or running Rector in docker keeps changing owner of your project files, running container as current user `--user $(id -u):$(id -g)` should solve it for you:
|
|
||||||
```
|
|
||||||
docker run --rm --user $(id -u):$(id -g) -v $(pwd):/project rector/rector process src --config rector.php --dry-run
|
|
||||||
```
|
|
Loading…
Reference in New Issue