2021-06-06 01:01:58 +08:00
|
|
|
FROM alpine:latest
|
2021-06-02 00:33:47 +08:00
|
|
|
|
2021-06-02 19:57:55 +08:00
|
|
|
# define script basic information
|
|
|
|
|
# Version of this Dockerfile
|
2022-04-12 00:50:58 +08:00
|
|
|
ENV SCRIPT_VERSION=1.4.2
|
2021-06-02 19:57:55 +08:00
|
|
|
# Download address uses backup address
|
2021-08-30 17:08:37 +08:00
|
|
|
|
|
|
|
|
ARG USE_BACKUP_ADDRESS
|
|
|
|
|
ARG COMPILE_PHP_VERSION
|
|
|
|
|
|
2021-06-02 19:57:55 +08:00
|
|
|
# (if downloading slowly, consider set it to yes)
|
2021-08-30 17:02:18 +08:00
|
|
|
ENV USE_BACKUP="${USE_BACKUP_ADDRESS}"
|
2021-06-02 00:33:47 +08:00
|
|
|
|
2021-06-02 19:57:55 +08:00
|
|
|
# Version of some manually-installed package
|
2021-08-30 17:02:18 +08:00
|
|
|
ENV VER_PHP="${COMPILE_PHP_VERSION}"
|
2021-06-06 01:01:58 +08:00
|
|
|
|
|
|
|
|
# APK repositories mirror address, if u r not in China, consider set USE_BACKUP=yes to boost
|
2021-06-02 19:57:55 +08:00
|
|
|
ENV LINK_APK_REPO='mirrors.ustc.edu.cn'
|
|
|
|
|
ENV LINK_APK_REPO_BAK='dl-cdn.alpinelinux.org'
|
2021-06-02 00:33:47 +08:00
|
|
|
|
2021-06-02 19:57:55 +08:00
|
|
|
RUN if [ "${USE_BACKUP}" = "yes" ]; then \
|
|
|
|
|
echo "Using backup address..." && sleep 3s; \
|
|
|
|
|
else \
|
|
|
|
|
echo "Using original address..." && sleep 3s; \
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
RUN sed -i 's/dl-cdn.alpinelinux.org/'${LINK_APK_REPO}'/g' /etc/apk/repositories
|
|
|
|
|
|
|
|
|
|
# build requirements
|
2022-04-02 16:07:11 +08:00
|
|
|
RUN apk add bash wget cmake gcc g++ jq autoconf git libstdc++ linux-headers make m4 libgcc binutils ncurses > /dev/null
|
2021-06-02 19:57:55 +08:00
|
|
|
# php zlib dependencies
|
2022-04-02 16:07:11 +08:00
|
|
|
RUN apk add zlib-dev zlib-static > /dev/null
|
2021-06-02 19:57:55 +08:00
|
|
|
# php mbstring dependencies
|
2022-04-02 16:07:11 +08:00
|
|
|
RUN apk add oniguruma-dev > /dev/null
|
2021-06-02 19:57:55 +08:00
|
|
|
# php openssl dependencies
|
2022-04-02 16:07:11 +08:00
|
|
|
RUN apk add openssl-libs-static openssl-dev openssl > /dev/null
|
2021-06-02 19:57:55 +08:00
|
|
|
# php gd dependencies
|
2022-04-02 16:07:11 +08:00
|
|
|
RUN apk add libpng-dev libpng-static > /dev/null
|
2021-06-02 19:57:55 +08:00
|
|
|
# curl c-ares dependencies
|
2022-04-02 16:07:11 +08:00
|
|
|
RUN apk add c-ares-static c-ares-dev > /dev/null
|
2021-06-06 01:01:58 +08:00
|
|
|
# php event dependencies
|
2022-04-02 16:07:11 +08:00
|
|
|
RUN apk add libevent libevent-dev libevent-static > /dev/null
|
2021-07-22 05:24:14 +00:00
|
|
|
# php sqlite3 dependencies
|
2022-04-02 16:07:11 +08:00
|
|
|
RUN apk add sqlite sqlite-dev sqlite-libs sqlite-static > /dev/null
|
2021-06-02 00:33:47 +08:00
|
|
|
|
|
|
|
|
RUN mkdir /app
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
2021-06-06 01:01:58 +08:00
|
|
|
COPY ac_override_1 /app/
|
|
|
|
|
COPY ac_override_2 /app/
|
2021-06-02 19:57:55 +08:00
|
|
|
COPY download.sh /app/
|
2021-06-06 01:01:58 +08:00
|
|
|
COPY config.json /app/
|
2021-06-02 00:33:47 +08:00
|
|
|
|
2021-06-06 01:01:58 +08:00
|
|
|
RUN chmod +x /app/download.sh
|
2021-06-02 00:33:47 +08:00
|
|
|
|
2022-04-02 16:07:11 +08:00
|
|
|
RUN echo "Downloading Extensions ..."
|
|
|
|
|
RUN ./download.sh swoole ${USE_BACKUP} > /dev/null && \
|
|
|
|
|
./download.sh inotify ${USE_BACKUP} > /dev/null && \
|
|
|
|
|
./download.sh mongodb ${USE_BACKUP} > /dev/null && \
|
|
|
|
|
./download.sh event ${USE_BACKUP} > /dev/null && \
|
|
|
|
|
./download.sh redis ${USE_BACKUP} > /dev/null && \
|
|
|
|
|
./download.sh libxml2 ${USE_BACKUP} > /dev/null && \
|
|
|
|
|
./download.sh liblzma ${USE_BACKUP} > /dev/null && \
|
|
|
|
|
./download.sh curl ${USE_BACKUP} > /dev/null
|
2021-06-02 19:57:55 +08:00
|
|
|
|
2022-04-02 16:07:11 +08:00
|
|
|
RUN echo "Downloading PHP ${VER_PHP} ..."
|
|
|
|
|
RUN ./download.sh php ${USE_BACKUP} ${VER_PHP} > /dev/null
|
2021-06-02 00:33:47 +08:00
|
|
|
|
2021-06-06 01:01:58 +08:00
|
|
|
COPY extensions.txt /app/
|
|
|
|
|
COPY check-extensions.sh /app/
|
|
|
|
|
COPY compile-php.sh /app/
|
2021-06-02 00:33:47 +08:00
|
|
|
|
2021-06-06 01:01:58 +08:00
|
|
|
RUN chmod +x ./check-extensions.sh && \
|
|
|
|
|
chmod +x ./compile-php.sh
|
2021-06-02 00:33:47 +08:00
|
|
|
|
2022-04-02 16:07:11 +08:00
|
|
|
RUN echo "Checking and Compiling Dependencies ..."
|
|
|
|
|
RUN ./check-extensions.sh check_before_configure > /dev/null
|
2021-06-02 00:33:47 +08:00
|
|
|
|
2022-04-02 16:07:11 +08:00
|
|
|
RUN echo "Compiling PHP ..."
|
|
|
|
|
RUN ./compile-php.sh ${VER_PHP} > /dev/null 2>&1
|