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

Dockerized Version #51

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
composer.lock
vendor
.idea
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM composer AS composer

WORKDIR /app

COPY composer.json .

RUN composer install \
--ignore-platform-reqs \
--no-interaction \
--no-plugins \
--no-scripts \
--prefer-dist

# Final PHP Image
FROM php:7.2-alpine

WORKDIR /obfuscator

COPY ./ ./
COPY --from=composer /app/vendor/ /obfuscator/vendor/

ENV PATH="/obfuscator/bin:${PATH}"

ENTRYPOINT ["php", "/obfuscator/bin/obfuscate", "obfuscate"]
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,26 @@ You can run the obfuscator with a configuration file through
```bash
./bin/obfuscate obfuscate /input/directory /output/directory --config=/foo/bar/config.yml
```

### Dockerized Version

You can use the Docker image to obfuscate your code
```bash
docker run --rm -it -v ./source:/code lion2486/naneau-php-obfuscator /code
```

Or you can use the image to integrate it in your docker build pipeline using multi-stage build.

1. Add the obfuscator stage as below:
```
FROM lion2486/naneau-php-obfuscator AS obfuscator

COPY . /code

RUN php bin/obfuscate obfuscate /code
```

2. Copy your sources from the previous image like below:
```
COPY --from=obfuscator /code /var/www
```