-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (35 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
42 lines (35 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Duplicated from https://github.com/cytopia/docker-phpcbf
# but using PHPCSStandards/PHP_CodeSniffer instead of
# abandoned squizlabs/PHP_CodeSniffer.
ARG PHP_IMG_TAG=cli-alpine
FROM php:${PHP_IMG_TAG} AS builder
# Install build dependencies
RUN set -eux \
&& apk add --no-cache \
ca-certificates \
# coreutils add 'sort -V'
coreutils \
curl \
git \
&& git clone https://github.com/PHPCSStandards/PHP_CodeSniffer
ARG PCS_VERSION=latest
RUN set -eux \
&& cd PHP_CodeSniffer \
&& if [ "${PCS_VERSION}" = "latest" ]; then \
VERSION="$( git describe --abbrev=0 --tags )"; \
else \
VERSION="$( git tag | grep -E "^v?${PCS_VERSION}\.[.0-9]+\$" | sort -V | tail -1 )"; \
fi \
&& echo "Version: ${VERSION}" \
&& curl -sS -L https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/${VERSION}/phpcbf.phar -o /phpcbf.phar \
&& chmod +x /phpcbf.phar \
&& mv /phpcbf.phar /usr/bin/phpcbf \
\
&& phpcbf --version
ARG PHP_IMG_TAG=cli-alpine
FROM php:${PHP_IMG_TAG} AS production
COPY --from=builder /usr/bin/phpcbf /usr/bin/phpcbf
ENV WORKDIR /data
WORKDIR /data
ENTRYPOINT ["phpcbf"]
CMD ["--version"]