equip-reserve-build/docker-entrypoint.sh

22 lines
788 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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