|
@@ -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 && \
|