feat: docker timezone follow host timezone
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
ProjectL=wfc
|
||||
ProjectU=WFC
|
||||
#RelVersion=1.0.6
|
||||
RelDate=`date +%Y%m%d`
|
||||
GitRootDir=${HOME}/wfc.git
|
||||
BERootDir=${GitRootDir}/be.wfc
|
||||
|
||||
@@ -81,14 +81,30 @@ case "$1" in
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
if [ ! -z "${new_ip}" ]; then
|
||||
# 使用sed命令替换IP地址
|
||||
# 替换.env文件
|
||||
sed "s/WFC_SERVER_IP=.*/WFC_SERVER_IP=${new_ip}/" ${org_env_file} > $tmp_env_file
|
||||
# sed -i "s/GATEWAY_ADDR=.*/GATEWAY_ADDR=${new_ip}:8080/" $tmp_env_file
|
||||
mv $tmp_env_file $org_env_file
|
||||
fi
|
||||
|
||||
# Check system timezone
|
||||
if [ -f /etc/timezone ]; then
|
||||
TIMEZONE=$(cat /etc/timezone)
|
||||
elif [ -f /etc/localtime ]; then
|
||||
TIMEZONE=$(readlink /etc/localtime | sed 's|.*/zoneinfo/||')
|
||||
else
|
||||
TIMEZONE="UTC"
|
||||
fi
|
||||
if grep -q "TZ=" ${org_env_file}; then
|
||||
sed "s|TZ=.*|TZ=${TIMEZONE}|" ${org_env_file} > $tmp_env_file
|
||||
else
|
||||
echo "TZ=${TIMEZONE}" >> ${org_env_file}
|
||||
fi
|
||||
mv $tmp_env_file $org_env_file
|
||||
|
||||
|
||||
# replace nginx.conf gateway server ip and port
|
||||
|
||||
while IFS= read -r line; do
|
||||
|
||||
@@ -4,6 +4,9 @@ services:
|
||||
container_name: ${MYSQL_SERVICE_NAME}
|
||||
build:
|
||||
context: ./mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
|
||||
- TZ=${TZ}
|
||||
ports:
|
||||
- "${MYSQL_SERVICE_PORT}:${MYSQL_SERVICE_PORT}"
|
||||
networks:
|
||||
@@ -14,8 +17,6 @@ services:
|
||||
- ./mysql/logs:/opt/wfc/mysql/logs
|
||||
- ./mysql/data:/var/lib/mysql
|
||||
- ./mysql/tmp:/tmp
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "mysqladmin ping -u root -p'${MYSQL_ROOT_PASSWORD}'"]
|
||||
interval: 10s
|
||||
@@ -28,6 +29,8 @@ services:
|
||||
container_name: wfc-redis
|
||||
build:
|
||||
context: ./redis
|
||||
environment:
|
||||
- TZ=${TZ}
|
||||
ports:
|
||||
- "${REDIS_PORT}:${REDIS_PORT}"
|
||||
networks:
|
||||
@@ -62,6 +65,7 @@ services:
|
||||
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
|
||||
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
|
||||
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/home/nacos/conf/
|
||||
- TZ=${TZ}
|
||||
volumes:
|
||||
- ./nacos/logs/:/home/nacos/logs
|
||||
- ./nacos/conf/application.properties:/home/nacos/conf/application.properties
|
||||
@@ -108,6 +112,7 @@ services:
|
||||
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
|
||||
- GATEWAY_SERVER_PORT=${GATEWAY_SERVER_PORT}
|
||||
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
|
||||
- TZ=${TZ}
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:${GATEWAY_SERVER_PORT}/actuator/health || exit 1"]
|
||||
interval: 30s
|
||||
@@ -144,6 +149,7 @@ services:
|
||||
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
|
||||
- AUTH_SERVER_PORT=${AUTH_SERVER_PORT}
|
||||
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
|
||||
- TZ=${TZ}
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:${AUTH_SERVER_PORT}/actuator/health || exit 1"]
|
||||
interval: 30s
|
||||
@@ -180,6 +186,7 @@ services:
|
||||
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
|
||||
- WFC_SYSTEM_PORT=${WFC_SYSTEM_PORT}
|
||||
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
|
||||
- TZ=${TZ}
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:${WFC_SYSTEM_PORT}/actuator/health || exit 1"]
|
||||
interval: 30s
|
||||
@@ -216,6 +223,7 @@ services:
|
||||
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
|
||||
- WFC_USER_PORT=${WFC_USER_PORT}
|
||||
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
|
||||
- TZ=${TZ}
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:${WFC_USER_PORT}/actuator/health || exit 1"]
|
||||
interval: 30s
|
||||
@@ -250,6 +258,7 @@ services:
|
||||
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
|
||||
- WFC_FILE_PORT=${WFC_FILE_PORT}
|
||||
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
|
||||
- TZ=${TZ}
|
||||
restart: ${RESTART_OPTION}
|
||||
|
||||
wfc-modules-job:
|
||||
@@ -279,6 +288,7 @@ services:
|
||||
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
|
||||
- WFC_JOB_PORT=${WFC_JOB_PORT}
|
||||
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
|
||||
- TZ=${TZ}
|
||||
restart: ${RESTART_OPTION}
|
||||
|
||||
wfc-modules-payment:
|
||||
@@ -311,6 +321,7 @@ services:
|
||||
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
|
||||
- WFC_PAYMENT_PORT=${WFC_PAYMENT_PORT}
|
||||
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
|
||||
- TZ=${TZ}
|
||||
restart: ${RESTART_OPTION}
|
||||
|
||||
wfc-nginx:
|
||||
@@ -338,6 +349,7 @@ services:
|
||||
- GATEWAY_SERVER_PORT=${GATEWAY_SERVER_PORT}
|
||||
- WFC_SERVER_IP=${WFC_SERVER_IP}
|
||||
- WFC_SERVER_PORT=${WFC_SERVER_PORT}
|
||||
- TZ=${TZ}
|
||||
restart: ${RESTART_OPTION}
|
||||
|
||||
networks:
|
||||
|
||||
2
build/docker/env/default.env
vendored
2
build/docker/env/default.env
vendored
@@ -23,4 +23,4 @@ WFC_SERVER_IP=192.168.13.128
|
||||
NACOS_SERVER_IP=${WFC_SERVER_IP}
|
||||
GATEWAY_SERVER_IP=${WFC_SERVER_IP}
|
||||
RESTART_OPTION=on-failure:5
|
||||
|
||||
TZ=Asia/Shanghai
|
||||
|
||||
Reference in New Issue
Block a user