Skip to content

Instantly share code, notes, and snippets.

@cored0wn
Last active February 18, 2022 21:27
Show Gist options
  • Save cored0wn/26baf98ccf84ccd9682771d549e1222c to your computer and use it in GitHub Desktop.
Save cored0wn/26baf98ccf84ccd9682771d549e1222c to your computer and use it in GitHub Desktop.
phpcs docker vscode
FROM php:cli-alpine
MAINTAINER Christopher Wittor <chris@wittor.IT>
RUN apk --no-cache add git
WORKDIR /tmp
RUN curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar && \
cp /tmp/phpcs.phar /usr/local/bin/phpcs && \
chmod +x /usr/local/bin/phpcs
WORKDIR /
RUN git clone -b master https://github.com/WordPress/WordPress-Coding-Standards.git /opt/wpcs && \
phpcs --config-set installed_paths /opt/wpcs
RUN phpcs --config-set show_progress 1 && \
phpcs --config-set colors 1 && \
phpcs --config-set report_width 140 && \
phpcs --config-set encoding utf-8
ENTRYPOINT ["phpcs"]
CMD ["--version"]
#!/bin/sh
# Works on Mac mini M1
p=$(echo "$@" | sed "s,--stdin-path=,,")
docker run -v $(pwd):$(pwd) -w=$(pwd) --rm phpcs $p
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment