-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
77 lines (66 loc) · 1.7 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
73
74
75
76
77
FROM php:7.4-cli
ENV DEBIAN_FRONTEND noninteractive
RUN set -e; \
\
savedAptMark="$(apt-mark showmanual)" \
> /dev/null; \
\
apt-get -qq update; \
\
# Install required packages
apt-get install -qq --no-install-suggests --no-install-recommends \
software-properties-common \
python3-software-properties \
git \
libzip-dev \
unzip \
wget \
strip-nondeterminism \
ssh \
> /dev/null; \
\
docker-php-ext-install zip \
> /dev/null; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' \
> /dev/null; \
apt-mark manual $savedAptMark \
> /dev/null; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual \
> /dev/null; \
\
rm -rf /var/lib/apt/lists/*
# Create an unprivileged user & change directory
RUN adduser --disabled-password --gecos "" user
WORKDIR /home/user/
# Install Phing
COPY ./phing-fetch.sh ./phing-fetch.sh
RUN chmod +x phing-fetch.sh; \
./phing-fetch.sh; \
rm -f ./phing-fetch.sh; \
cp phing-latest.phar /usr/local/bin/phing; \
chmod +x /usr/local/bin/phing;
# Set custom PHP configuration directives
RUN { \
echo 'memory_limit=2G'; \
echo 'include_path=".:/usr/local/lib/php"'; \
} > /usr/local/etc/php/conf.d/php-custom.ini
# Add build scripts
COPY ./php/ ./php/
RUN chmod +x ./php/*.php
# Add Phing project build file
COPY ./build.xml ./build.xml
# Add entrypoint script
COPY ./docker-entrypoint.sh ./docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh
# Switch to the added user
USER user
ENV GIT_TERMINAL_PROMPT=0
ENTRYPOINT ["./docker-entrypoint.sh"]