推送镜像指令

highway
zhaoxiaolin 1 year ago
parent d4ce34c332
commit 50da3686fb

@ -0,0 +1,40 @@
@echo off
echo --------------------------------自定义参数,启动前先修改--------------------------------------
set jarName=op-modules-device.jar
set profile=dev
set imageURI=192.168.202.36:30002/op-lanju/op-device
rem echo 获取当前日期字符串
for /f "tokens=1,2,3 delims=/- " %%a in ("%date%") do @set D=%%a%%b%%c
rem echo 获取当前时间字符串
for /f "tokens=1,2 delims=:." %%a in ("%time%") do @set T=%%a%%b
rem echo 如当前小时小于10将空格替换为0
set T=%T: =0%
rem echo 显示输出日期时间字符串
set imageVersion=%D%%T%
::输出发版信息
echo jar包名称:%jarName%
echo 启动环境:%profile%
echo 镜像库地址:%imageURI%
echo 镜像版本:%imageVersion%
echo --------------------------------mvn package...--------------------------------
::call mvn clean package -Dmaven.test.skip=true
cd .\target
SET df=Dockerfile
if exist %df% (
del /f /s /q .\Dockerfile
)
echo --------------------------------创建Dockerfile--------------------------------
echo FROM 192.168.202.36:30002/library/openjdk:8u131-jdk-alpine >> Dockerfile
echo COPY %jarName% /application.jar >> Dockerfile
echo RUN echo "Asia/Shanghai" ^> /etc/timezone >> Dockerfile
echo CMD ["java", "-jar", "-Dspring.profiles.active=%profile%", "application.jar"] >> Dockerfile
dir
echo --------------------------------docker login...-------------------------------
docker login 192.168.202.36:30002 -u deploy -p Deploy@2023
echo --------------------------------docker build...-------------------------------
docker build -t %imageURI%:%imageVersion% .
echo --------------------------------docker push...--------------------------------
docker push %imageURI%:%imageVersion%
@pause

@ -27,7 +27,8 @@ if exist %df% (
del /f /s /q .\Dockerfile
)
echo --------------------------------´´½¨Dockerfile--------------------------------
echo FROM 192.168.202.36:30002/library/openjdk:8u131-jdk-alpine >> Dockerfile
echo FROM 192.168.202.36:30002/library/openjdk:8-sw66>> Dockerfile
::echo RUN apk add libuuid libuuid-devel >> Dockerfile
echo ADD libsapjco3.so /usr/lib/libsapjco3.so >> Dockerfile
echo ADD sapjco3.jar /usr/lib/sapjco3.jar >> Dockerfile
echo RUN chmod a+x -R /usr/lib/libsapjco3.so >> Dockerfile
@ -37,7 +38,7 @@ echo RUN echo "Asia/Shanghai" ^> /etc/timezone >> Dockerfile
echo CMD ["java", "-jar", "-Dspring.profiles.active=%profile%", "application.jar"] >> Dockerfile
dir
echo --------------------------------docker login...-------------------------------
docker login 192.168.202.36:30002 -u deploy -p Deploy@2023
docker login 192.168.202.36:30002 -u admin -p Harbor@2023
echo --------------------------------docker build...-------------------------------
docker build -t %imageURI%:%imageVersion% .
echo --------------------------------docker push...--------------------------------

Loading…
Cancel
Save