Pārlūkot izejas kodu

优化 dockerifle

kphcdr 1 gadu atpakaļ
vecāks
revīzija
209d03467a
2 mainītis faili ar 18 papildinājumiem un 25 dzēšanām
  1. 1 0
      .gitignore
  2. 17 25
      service/php/Dockerfile

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
 .idea
 data
 logs
+.env

+ 17 - 25
service/php/Dockerfile

@@ -6,48 +6,40 @@ ENV TZ="Asia/Shanghai"
 
 RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 
-#RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
-#    echo "deb http://mirrors.aliyu  n.com/debian/ buster main non-free contrib" >/etc/apt/sources.list && \
-#    echo "deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib" >>/etc/apt/sources.list && \
-#    echo "deb http://mirrors.aliyun.com/debian-security buster/updates main" >>/etc/apt/sources.list && \
-#    echo "deb-src http://mirrors.aliyun.com/debian-security buster/updates main" >>/etc/apt/sources.list && \
-#    echo "deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib" >>/etc/apt/sources.list && \
-#    echo "deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib" >>/etc/apt/sources.list && \
-#    echo "deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib" >>/etc/apt/sources.list && \
-#    echo "deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib" >>/etc/apt/sources.list
 # Utils
 RUN apt-get update && \
-    apt-get install -y libssl-dev libaio-dev net-tools dnsutils && \
-    apt-get clean
+    apt-get install -y --no-install-recommends \
+        libssl-dev libaio-dev net-tools dnsutils && \
+    rm -rf /var/lib/apt/lists/*
+
 # Composer
-RUN curl -sS https://getcomposer.org/installer | php && \
-    mv composer.phar /usr/local/bin/composer && \
+RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
     composer self-update --clean-backups && \
     composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
 
 # Core Libs
 RUN echo "Installing Core Libs..." && \
-    #gd
-    apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev && \
+    # GD
+    apt-get update && \
+    apt-get install -y --no-install-recommends \
+        libfreetype6-dev libjpeg62-turbo-dev libpng-dev && \
+    rm -rf /var/lib/apt/lists/* && \
     docker-php-ext-configure gd --with-freetype --with-jpeg && \
     docker-php-ext-install -j$(nproc) gd && \
-
     # bcmath
     docker-php-ext-install bcmath && \
-
     # sockets
     docker-php-ext-install sockets && \
-
     # MySQL extension
-    docker-php-ext-install mysqli && \
-    docker-php-ext-install pdo_mysql && \
-
+    docker-php-ext-install mysqli pdo_mysql && \
     # Redis
     pecl install redis && \
-    docker-php-ext-enable redis
-
-# ZIP
-RUN apt-get install -y libzip-dev && \
+    docker-php-ext-enable redis && \
+    # ZIP
+    apt-get update && \
+    apt-get install -y --no-install-recommends \
+        libzip-dev && \
+    rm -rf /var/lib/apt/lists/* && \
     docker-php-ext-install -j$(nproc) zip
 
 # Expose port 9000