22 lines
788 B
Bash
22 lines
788 B
Bash
|
#!/bin/bash
|
|||
|
set -e
|
|||
|
|
|||
|
# 1. 如果宿主机 /equip-reserve 目录里提供了新 jar / dist,则覆盖镜像内的
|
|||
|
[ -f /equip-reserve/equip-reserve-backend.jar ] && cp -f /equip-reserve/equip-reserve-backend.jar /app/equip-reserve-backend.jar
|
|||
|
[ -d /equip-reserve/dist ] && cp -rf /equip-reserve/dist/* /usr/share/nginx/html/
|
|||
|
|
|||
|
# 2. 启动 mysql(执行官方镜像中的启动脚本)
|
|||
|
# 官方镜像会按字母顺序执行/docker-entrypoint-initdb.d/下的脚本,实现数据初始化
|
|||
|
docker-entrypoint.sh mysqld &
|
|||
|
|
|||
|
# 3. 等待 mysql 就绪
|
|||
|
until mysqladmin ping -hlocalhost -P3306 --silent; do
|
|||
|
echo "waiting for mysql..."
|
|||
|
sleep 1
|
|||
|
done
|
|||
|
|
|||
|
# 4. 启动 nginx
|
|||
|
nginx
|
|||
|
|
|||
|
# 5. 启动 spring boot
|
|||
|
exec java -jar /app/equip-reserve-backend.jar --spring.profiles.active=prod > /dev/null 2>&1
|