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
@ -1636,4 +1638,4 @@ services:
depends_on: depends_on:
- postgres - postgres
volumes: volumes:
- ${DATA_PATH_HOST}/Confluence:/var/atlassian/application-data - ${DATA_PATH_HOST}/Confluence:/var/atlassian/application-data

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 \
@ -50,7 +58,7 @@ ARG INSTALL_CASSANDRA=false
RUN if [ ${INSTALL_CASSANDRA} = true ]; then \ RUN if [ ${INSTALL_CASSANDRA} = true ]; then \
apk --update add cassandra-cpp-driver \ apk --update add cassandra-cpp-driver \
;fi ;fi
# Install PhpRedis package: # Install PhpRedis package:
ARG INSTALL_PHPREDIS=false ARG INSTALL_PHPREDIS=false
RUN if [ ${INSTALL_PHPREDIS} = true ]; then \ RUN if [ ${INSTALL_PHPREDIS} = true ]; then \

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.
@ -270,10 +274,10 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \
ARG INSTALL_XHPROF=false ARG INSTALL_XHPROF=false
RUN if [ ${INSTALL_XHPROF} = true ]; then \ RUN if [ ${INSTALL_XHPROF} = true ]; then \
# Install the php xhprof extension # Install the php xhprof extension
if [ $(php -r "echo PHP_MAJOR_VERSION;") = 7 ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = 7 ]; then \
curl -L -o /tmp/xhprof.tar.gz "https://github.com/tideways/php-xhprof-extension/archive/v4.1.7.tar.gz"; \ curl -L -o /tmp/xhprof.tar.gz "https://github.com/tideways/php-xhprof-extension/archive/v4.1.7.tar.gz"; \
else \ else \
curl -L -o /tmp/xhprof.tar.gz "https://codeload.github.com/phacility/xhprof/tar.gz/master"; \ curl -L -o /tmp/xhprof.tar.gz "https://codeload.github.com/phacility/xhprof/tar.gz/master"; \
fi \ fi \
&& mkdir -p xhprof \ && mkdir -p xhprof \

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