init
This commit is contained in:
parent
457e43fca8
commit
4bb826818c
18
pom.xml
18
pom.xml
|
|
@ -62,7 +62,25 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>docker</id>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>application**</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<finalName>lyxh-api-docking</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
FROM openjdk:17.0.2-slim
|
||||
WORKDIR /app
|
||||
|
||||
COPY scripts/docker/entrypoint.sh /app
|
||||
RUN ln -snf /usr/share/zoneinfo/Hongkong /etc/localtime && chmod +x /app/entrypoint.sh && mkdir -p /app/conf/
|
||||
COPY src/main/resources/application.yml /app/conf/
|
||||
COPY target/*.jar app.jar
|
||||
|
||||
EXPOSE 80
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
|
||||
SPRING_CUSTOM_CONFIG=""
|
||||
|
||||
################################################## active config start #################################################
|
||||
if [ "${SPRING_PROFILE_ACTIVE}" ];then
|
||||
SPRING_CUSTOM_CONFIG="${SPRING_CUSTOM_CONFIG} -Dspring.profiles.active='$SPRING_PROFILE_ACTIVE'"
|
||||
else
|
||||
SPRING_CUSTOM_CONFIG="${SPRING_CUSTOM_CONFIG} -Dspring.profiles.active='docker'"
|
||||
fi
|
||||
################################################## active config end ###################################################
|
||||
|
||||
################################################## spring config location start ########################################
|
||||
if [ "${SPRING_CONFIG_LOCATION}" ];then
|
||||
SPRING_CUSTOM_CONFIG="${SPRING_CUSTOM_CONFIG} -Dspring.config.additional-location='$SPRING_CONFIG_LOCATION'"
|
||||
else
|
||||
SPRING_CUSTOM_CONFIG="${SPRING_CUSTOM_CONFIG} -Dspring.config.additional-location='/app/conf/'"
|
||||
fi
|
||||
################################################## spring config location end #########################################
|
||||
|
||||
################################################## timezone config start #################################################
|
||||
if [ "${SPRING_USER_TIMEZONE}" ];then
|
||||
SPRING_CUSTOM_CONFIG="${SPRING_CUSTOM_CONFIG} -Duser.timezone='$SPRING_USER_TIMEZONE'"
|
||||
else
|
||||
SPRING_CUSTOM_CONFIG="${SPRING_CUSTOM_CONFIG} -Duser.timezone='GMT+08'"
|
||||
fi
|
||||
################################################## timezone config end ###################################################
|
||||
|
||||
sh -c "java -server ${SPRING_CUSTOM_CONFIG} ${SPRING_OPTS} ${JAVA_OPTS} -jar /app/app.jar"
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
version='v1.0.0'
|
||||
current_date=$(date "+%Y%m%d")
|
||||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
|
||||
cd ${SHELL_FOLDER}
|
||||
|
||||
#编译项目
|
||||
cd ../
|
||||
mvn clean package -DskipTests -Pdocker
|
||||
|
||||
#编译
|
||||
docker build -f scripts/docker/Dockerfile -t xmodel/third-futong-api:${version} .
|
||||
|
||||
#仓库地址
|
||||
model_registry=registry.cn-hangzhou.aliyuncs.com/xmodel/third-futong-api:${version}-"${current_date}"-release
|
||||
|
||||
#重命名镜像
|
||||
docker tag xmodel/third-futong-api:${version} "${model_registry}"
|
||||
|
||||
#打印
|
||||
echo "docker push ${model_registry}"
|
||||
Loading…
Reference in New Issue