Skip to content

Commit b6204e5

Browse files
author
牟勇
committed
pref: add change source flag
1 parent ba23f41 commit b6204e5

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

docker-compose.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ services:
234234
build:
235235
context: ./php-worker
236236
args:
237+
- CHANGE_SOURCE=${CHANGE_SOURCE}
237238
- PHP_VERSION=${PHP_VERSION}
238239
- PHALCON_VERSION=${PHALCON_VERSION}
239240
- INSTALL_PGSQL=${PHP_WORKER_INSTALL_PGSQL}
@@ -267,6 +268,7 @@ services:
267268
build:
268269
context: ./laravel-horizon
269270
args:
271+
- CHANGE_SOURCE=${CHANGE_SOURCE}
270272
- PHP_VERSION=${PHP_VERSION}
271273
- INSTALL_PGSQL=${PHP_FPM_INSTALL_PGSQL}
272274
- INSTALL_BCMATH=${PHP_FPM_INSTALL_BCMATH}
@@ -290,9 +292,9 @@ services:
290292
build:
291293
context: ./nginx
292294
args:
295+
- CHANGE_SOURCE=${CHANGE_SOURCE}
293296
- PHP_UPSTREAM_CONTAINER=${NGINX_PHP_UPSTREAM_CONTAINER}
294297
- PHP_UPSTREAM_PORT=${NGINX_PHP_UPSTREAM_PORT}
295-
- CHANGE_SOURCE=${CHANGE_SOURCE}
296298
- http_proxy
297299
- https_proxy
298300
- no_proxy

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-worker/Dockerfile

Lines changed: 8 additions & 0 deletions
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 \

0 commit comments

Comments
 (0)