forked from rtCamp/action-phpcs-code-review
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
72 lines (61 loc) · 2.57 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
65
66
67
68
69
70
71
72
# ubuntu:latest as of 2023-02-27
FROM ubuntu@sha256:9a0bdde4188b896a372804be2384015e90e3f84906b750c1a53539b585fbbe7f
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 VAULT_VERSION=1.12.3
ARG DEFAULT_PHP_VERSION=8.1
ARG PHP_BINARIES_TO_PREINSTALL='7.4 8.0 8.1 8.2'
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} \
&& wget https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip \
&& unzip vault_${VAULT_VERSION}_linux_amd64.zip \
&& mv vault /usr/local/bin/vault \
# cleanup
&& rm -f vault_${VAULT_VERSION}_linux_amd64.zip \
&& 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 \
&& vault -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"]