You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.6 KiB
Batchfile

1 year ago
@echo off
echo --------------------------------<2D>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>޸<EFBFBD>--------------------------------------
set jarName=op-modules-mes.jar
set profile=dev
set imageURI=192.168.202.36:30002/op-lanju/op-mes
rem echo <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
for /f "tokens=1,2,3 delims=/- " %%a in ("%date%") do @set D=%%a%%b%%c
rem echo <20><>ȡ<EFBFBD><C8A1>ǰʱ<C7B0><CAB1><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
for /f "tokens=1,2 delims=:." %%a in ("%time%") do @set T=%%a%%b
rem echo <20>統ǰСʱС<CAB1><D0A1>10<31><30><EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD><D5B8>滻Ϊ0
set T=%T: =0%
rem echo <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
set imageVersion=%D%%T%
::<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
echo jar<61><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%jarName%
echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%profile%
echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ:%imageURI%
echo <20><><EFBFBD><EFBFBD><EFBFBD>汾:%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 --------------------------------<2D><><EFBFBD><EFBFBD>Dockerfile--------------------------------
echo FROM 192.168.202.36:30002/library/openjdk:8u131-jdk-alpine >> Dockerfile
1 year ago
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