Merge pull request #1905 from mouyong/master

change some container source when in china
This commit is contained in:
Shao Yu-Lung (Allen) 2019-12-06 19:25:02 +08:00 committed by GitHub
commit 818d61ab54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 6 deletions

View File

@ -59,6 +59,7 @@ services:
build: build:
context: ./workspace context: ./workspace
args: args:
- CHANGE_SOURCE=${CHANGE_SOURCE}
- LARADOCK_PHP_VERSION=${PHP_VERSION} - LARADOCK_PHP_VERSION=${PHP_VERSION}
- LARADOCK_PHALCON_VERSION=${PHALCON_VERSION} - LARADOCK_PHALCON_VERSION=${PHALCON_VERSION}
- INSTALL_SUBVERSION=${WORKSPACE_INSTALL_SUBVERSION} - INSTALL_SUBVERSION=${WORKSPACE_INSTALL_SUBVERSION}
@ -272,6 +273,7 @@ services:
build: build:
context: ./laravel-horizon context: ./laravel-horizon
args: args:
- CHANGE_SOURCE=${CHANGE_SOURCE}
- PHP_VERSION=${PHP_VERSION} - PHP_VERSION=${PHP_VERSION}
- INSTALL_PGSQL=${PHP_FPM_INSTALL_PGSQL} - INSTALL_PGSQL=${PHP_FPM_INSTALL_PGSQL}
- INSTALL_BCMATH=${PHP_FPM_INSTALL_BCMATH} - INSTALL_BCMATH=${PHP_FPM_INSTALL_BCMATH}
@ -295,9 +297,9 @@ services:
build: build:
context: ./nginx context: ./nginx
args: args:
- CHANGE_SOURCE=${CHANGE_SOURCE}
- PHP_UPSTREAM_CONTAINER=${NGINX_PHP_UPSTREAM_CONTAINER} - PHP_UPSTREAM_CONTAINER=${NGINX_PHP_UPSTREAM_CONTAINER}
- PHP_UPSTREAM_PORT=${NGINX_PHP_UPSTREAM_PORT} - PHP_UPSTREAM_PORT=${NGINX_PHP_UPSTREAM_PORT}
- CHANGE_SOURCE=${CHANGE_SOURCE}
- http_proxy - http_proxy
- https_proxy - https_proxy
- no_proxy - no_proxy

View File

@ -9,6 +9,14 @@ FROM php:${PHP_VERSION}-alpine
LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>" LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
ARG CHANGE_SOURCE=false
RUN if [ ${CHANGE_SOURCE} = true ]; then \
# Change application source from dl-cdn.alpinelinux.org to aliyun source
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \
;fi
RUN apk --update add wget \ RUN apk --update add wget \
curl \ curl \
git \ git \

View File

@ -23,10 +23,14 @@ ARG LARADOCK_PHP_VERSION
# Set Environment Variables # Set Environment Variables
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
# 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 CHANGE_SOURCE=false
RUN if [ ${CHANGE_SOURCE} = true ]; then \ RUN if [ ${CHANGE_SOURCE} = true ]; then \
# Change application source from deb.debian.org to aliyun source # Change application source from deb.debian.org to aliyun source
sed -i 's/deb.debian.org/mirrors.aliyun.com/' /etc/apt/sources.list \ 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 ;fi
# always run apt update when start and after add new source list, then clean up at end. # always run apt update when start and after add new source list, then clean up at end.

View File

@ -23,6 +23,16 @@ ARG LARADOCK_PHP_VERSION
# Set Environment Variables # Set Environment Variables
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
ARG CHANGE_SOURCE=false
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 # Start as root
USER root USER root