-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathDockerfile.php
executable file
·80 lines (65 loc) · 2.52 KB
/
Dockerfile.php
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
78
79
80
FROM alpine:3.16
# define script basic information
# Version of this Dockerfile
ENV SCRIPT_VERSION=1.5.1
# Download address uses backup address
ARG USE_BACKUP_ADDRESS
ARG PHP_VERSION
# (if downloading slowly, consider set it to yes)
ENV USE_BACKUP="${USE_BACKUP_ADDRESS}"
# APK repositories mirror address, if u r not in China, consider set USE_BACKUP=yes to boost
ENV LINK_APK_REPO='mirrors.ustc.edu.cn'
ENV LINK_APK_REPO_BAK='dl-cdn.alpinelinux.org'
RUN if [ "${USE_BACKUP}" = "" ]; then \
export USE_BACKUP="no" ; \
fi
RUN if [ "${USE_BACKUP}" = "yes" ]; then \
echo "Using backup original address..." ; \
else \
echo "Using mirror address..." && \
sed -i 's/dl-cdn.alpinelinux.org/'${LINK_APK_REPO}'/g' /etc/apk/repositories ; \
fi
# build requirements
RUN apk add bash file wget cmake gcc g++ jq autoconf git libstdc++ linux-headers make m4 libgcc binutils ncurses dialog > /dev/null
# php zlib dependencies
RUN apk add zlib-dev zlib-static > /dev/null
# php mbstring dependencies
RUN apk add oniguruma-dev > /dev/null
# php openssl dependencies
RUN apk add openssl-libs-static openssl-dev openssl > /dev/null
# php gd dependencies
RUN apk add libpng-dev libpng-static > /dev/null
# curl c-ares dependencies
RUN apk add c-ares-static c-ares-dev > /dev/null
# php event dependencies
RUN apk add libevent libevent-dev libevent-static > /dev/null
# php sqlite3 dependencies
RUN apk add sqlite sqlite-dev sqlite-libs sqlite-static > /dev/null
# php libzip dependencies
RUN apk add bzip2-dev bzip2-static bzip2 > /dev/null
# php micro ffi dependencies
RUN apk add libffi libffi-dev > /dev/null
# php gd event parent dependencies
RUN apk add zstd-static > /dev/null
# php readline dependencies
RUN apk add readline-static ncurses-static readline-dev > /dev/null
RUN mkdir /app
WORKDIR /app
COPY ./* /app/
RUN chmod +x /app/*.sh
RUN ./download.sh swoole ${USE_BACKUP} && \
./download.sh inotify ${USE_BACKUP} && \
./download.sh mongodb ${USE_BACKUP} && \
./download.sh event ${USE_BACKUP} && \
./download.sh redis ${USE_BACKUP} && \
./download.sh libxml2 ${USE_BACKUP} && \
./download.sh xz ${USE_BACKUP} && \
./download.sh curl ${USE_BACKUP} && \
./download.sh libzip ${USE_BACKUP} && \
./download-git.sh dixyes/phpmicro phpmicro ${USE_BACKUP}
RUN ./compile-deps.sh
RUN echo -e "#!/usr/bin/env bash\n/app/compile-php.sh \$@" > /bin/build-php && chmod +x /bin/build-php
RUN /bin/build-php no-mirror $PHP_VERSION all /dist
FROM scratch
ARG GOARCH
COPY --from=0 /dist/php /php_linux_$GOARCH