@@ -6,24 +6,14 @@ ARG PHP_EXTENSIONS
6
6
ARG CONTAINER_PACKAGE_URL
7
7
8
8
9
- COPY --from=composer /usr/bin/composer /usr/bin/composer
10
- COPY ./extensions /tmp/extensions
11
- WORKDIR /tmp/extensions
12
-
13
- # php alpine image's www-data user uid & gid are 82, change them to 1000 (primary user)
14
- RUN apk add shadow && usermod -u 1000 www-data && groupmod -g 1000 www-data
15
-
16
- RUN if [ "${CONTAINER_PACKAGE_URL}" != "" ]; then \
17
- sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories; \
18
- fi
19
-
20
-
21
- RUN if [ "${PHP_EXTENSIONS}" != "" ]; then \
22
- apk add --no-cache autoconf g++ libtool make curl-dev gettext-dev linux-headers; \
23
- fi
9
+ RUN sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories
24
10
25
11
26
- RUN chmod +x install.sh && sh install.sh && rm -rf /tmp/extensions
12
+ COPY ./extensions /tmp/extensions
13
+ WORKDIR /tmp/extensions
14
+ RUN chmod +x install.sh \
15
+ && sh install.sh \
16
+ && rm -rf /tmp/extensions
27
17
28
18
29
19
RUN apk --no-cache add tzdata \
@@ -35,9 +25,17 @@ RUN apk --no-cache add tzdata \
35
25
RUN apk add gnu-libiconv --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/edge/community/ --allow-untrusted
36
26
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
37
27
38
- # Install Composer
39
- RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
40
- # Change Composer Home
41
- ENV COMPOSER_HOME="/tmp/composer"
28
+
29
+ # Install composer and change it's cache home
30
+ RUN curl -o /usr/bin/composer https://mirrors.aliyun.com/composer/composer.phar \
31
+ && chmod +x /usr/bin/composer
32
+ ENV COMPOSER_HOME=/tmp/composer
33
+
34
+
35
+ # php image's www-data user uid & gid are 82, change them to 1000 (primary user)
36
+ RUN apk --no-cache add shadow && usermod -u 1000 www-data && groupmod -g 1000 www-data
37
+ # Use www-data to run the first process
38
+ USER www-data
39
+
42
40
43
41
WORKDIR /www
0 commit comments