Skip to content

Commit 818d61a

Browse files
authored
Merge pull request laradock#1905 from mouyong/master
change some container source when in china
2 parents c6fe34d + f3e3bbe commit 818d61a

4 files changed

Lines changed: 30 additions & 6 deletions

File tree

docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ services:
5959
build:
6060
context: ./workspace
6161
args:
62+
- CHANGE_SOURCE=${CHANGE_SOURCE}
6263
- LARADOCK_PHP_VERSION=${PHP_VERSION}
6364
- LARADOCK_PHALCON_VERSION=${PHALCON_VERSION}
6465
- INSTALL_SUBVERSION=${WORKSPACE_INSTALL_SUBVERSION}
@@ -272,6 +273,7 @@ services:
272273
build:
273274
context: ./laravel-horizon
274275
args:
276+
- CHANGE_SOURCE=${CHANGE_SOURCE}
275277
- PHP_VERSION=${PHP_VERSION}
276278
- INSTALL_PGSQL=${PHP_FPM_INSTALL_PGSQL}
277279
- INSTALL_BCMATH=${PHP_FPM_INSTALL_BCMATH}
@@ -295,9 +297,9 @@ services:
295297
build:
296298
context: ./nginx
297299
args:
300+
- CHANGE_SOURCE=${CHANGE_SOURCE}
298301
- PHP_UPSTREAM_CONTAINER=${NGINX_PHP_UPSTREAM_CONTAINER}
299302
- PHP_UPSTREAM_PORT=${NGINX_PHP_UPSTREAM_PORT}
300-
- CHANGE_SOURCE=${CHANGE_SOURCE}
301303
- http_proxy
302304
- https_proxy
303305
- no_proxy
@@ -1636,4 +1638,4 @@ services:
16361638
depends_on:
16371639
- postgres
16381640
volumes:
1639-
- ${DATA_PATH_HOST}/Confluence:/var/atlassian/application-data
1641+
- ${DATA_PATH_HOST}/Confluence:/var/atlassian/application-data

laravel-horizon/Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ FROM php:${PHP_VERSION}-alpine
99

1010
LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
1111

12+
# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
13+
14+
ARG CHANGE_SOURCE=false
15+
RUN if [ ${CHANGE_SOURCE} = true ]; then \
16+
# Change application source from dl-cdn.alpinelinux.org to aliyun source
17+
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \
18+
;fi
19+
1220
RUN apk --update add wget \
1321
curl \
1422
git \
@@ -50,7 +58,7 @@ ARG INSTALL_CASSANDRA=false
5058
RUN if [ ${INSTALL_CASSANDRA} = true ]; then \
5159
apk --update add cassandra-cpp-driver \
5260
;fi
53-
61+
5462
# Install PhpRedis package:
5563
ARG INSTALL_PHPREDIS=false
5664
RUN if [ ${INSTALL_PHPREDIS} = true ]; then \

php-fpm/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ ARG LARADOCK_PHP_VERSION
2323
# Set Environment Variables
2424
ENV DEBIAN_FRONTEND noninteractive
2525

26+
# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
27+
2628
ARG CHANGE_SOURCE=false
2729
RUN if [ ${CHANGE_SOURCE} = true ]; then \
2830
# Change application source from deb.debian.org to aliyun source
29-
sed -i 's/deb.debian.org/mirrors.aliyun.com/' /etc/apt/sources.list \
31+
sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list && \
32+
sed -i 's/security.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list && \
33+
sed -i 's/security-cdn.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list \
3034
;fi
3135

3236
# 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 \
270274
ARG INSTALL_XHPROF=false
271275

272276
RUN if [ ${INSTALL_XHPROF} = true ]; then \
273-
# Install the php xhprof extension
277+
# Install the php xhprof extension
274278
if [ $(php -r "echo PHP_MAJOR_VERSION;") = 7 ]; then \
275279
curl -L -o /tmp/xhprof.tar.gz "https://github.com/tideways/php-xhprof-extension/archive/v4.1.7.tar.gz"; \
276-
else \
280+
else \
277281
curl -L -o /tmp/xhprof.tar.gz "https://codeload.github.com/phacility/xhprof/tar.gz/master"; \
278282
fi \
279283
&& mkdir -p xhprof \

workspace/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ ARG LARADOCK_PHP_VERSION
2323
# Set Environment Variables
2424
ENV DEBIAN_FRONTEND noninteractive
2525

26+
# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
27+
28+
ARG CHANGE_SOURCE=false
29+
RUN if [ ${CHANGE_SOURCE} = true ]; then \
30+
# Change application source from deb.debian.org to aliyun source
31+
sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list && \
32+
sed -i 's/security.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list && \
33+
sed -i 's/security-cdn.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list \
34+
;fi
35+
2636
# Start as root
2737
USER root
2838

0 commit comments

Comments
 (0)