-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathDockerfile
64 lines (54 loc) · 2.2 KB
/
Dockerfile
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM ubuntu:24.04
LABEL "com.github.actions.icon"="check-circle"
LABEL "com.github.actions.color"="green"
LABEL "com.github.actions.name"="PHPCS Code Review"
LABEL "com.github.actions.description"="Run automated code review using PHPCS on your pull requests."
LABEL "org.opencontainers.image.source"="https://github.com/rtCamp/action-phpcs-code-review"
ARG DEFAULT_PHP_VERSION=8.3
ARG PHP_BINARIES_TO_PREINSTALL='7.4 8.0 8.1 8.2 8.3 8.4'
ENV DOCKER_USER=rtbot
ENV ACTION_WORKDIR=/home/$DOCKER_USER
ENV DEBIAN_FRONTEND=noninteractive
RUN useradd -m -s /bin/bash $DOCKER_USER \
&& mkdir -p $ACTION_WORKDIR \
&& chown -R $DOCKER_USER $ACTION_WORKDIR
RUN set -ex \
&& savedAptMark="$(apt-mark showmanual)" \
&& apt-mark auto '.*' > /dev/null \
&& apt-get update && apt-get install -y --no-install-recommends git ca-certificates wget rsync gnupg jq software-properties-common unzip \
&& LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php \
&& apt-get update \
&& for v in $PHP_BINARIES_TO_PREINSTALL; do \
apt-get install -y --no-install-recommends \
php"$v" \
php"$v"-curl \
php"$v"-tokenizer \
php"$v"-simplexml \
php"$v"-xmlwriter; \
done \
&& update-alternatives --set php /usr/bin/php${DEFAULT_PHP_VERSION} \
# cleanup
&& apt-get remove software-properties-common unzip -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& { [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; } \
&& find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
# smoke test
&& for v in $PHP_BINARIES_TO_PREINSTALL; do \
php"$v" -v; \
done \
&& php -v;
COPY entrypoint.sh main.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/main.sh
USER $DOCKER_USER
WORKDIR $ACTION_WORKDIR
RUN wget https://raw.githubusercontent.com/Automattic/vip-go-ci/latest/tools-init.sh -O tools-init.sh \
&& bash tools-init.sh \
&& rm -f tools-init.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]