Răsfoiți Sursa

feat(change source): move together

Shao Yu Lung 4 ani în urmă
părinte
comite
0e5977cc64
1 a modificat fișierele cu 14 adăugiri și 17 ștergeri
  1. 14 17
      workspace/Dockerfile

+ 14 - 17
workspace/Dockerfile

@@ -23,18 +23,25 @@ ARG LARADOCK_PHP_VERSION
 # Set Environment Variables
 ENV DEBIAN_FRONTEND noninteractive
 
+# Start as root
+USER root
+
+###########################################################################
 # If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
+###########################################################################
 
 ARG CHANGE_SOURCE=false
+ARG UBUNTU_SOURCE=aliyun
+COPY ./sources.sh /tmp/sources.sh
 RUN if [ ${CHANGE_SOURCE} = true ]; then \
     # Change application source from deb.debian.org to aliyun source
-    sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list && \
-    sed -i 's/security.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list && \
-    sed -i 's/security-cdn.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list \
-;fi
-
-# Start as root
-USER root
+    sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list; \
+    sed -i 's/security.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list; \
+    sed -i 's/security-cdn.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list; \
+    chmod +x /tmp/sources.sh; \
+    /bin/sh -c /tmp/sources.sh; \
+  fi; \
+  rm -rf /tmp/sources.sh
 
 ###########################################################################
 # Laradock non-root user:
@@ -46,16 +53,6 @@ ENV PUID ${PUID}
 ARG PGID=1000
 ENV PGID ${PGID}
 
-ARG CHANGE_SOURCE=false
-ARG UBUNTU_SOURCE
-COPY ./sources.sh /tmp/sources.sh
-
-RUN if [ ${CHANGE_SOURCE} = true ]; then \
-    chmod +x /tmp/sources.sh && \
-    /bin/sh -c /tmp/sources.sh && \
-    rm -rf /tmp/sources.sh \
-;fi
-
 # always run apt update when start and after add new source list, then clean up at end.
 RUN set -xe; \
     apt-get update -yqq && \