42 lines
932 B
Batchfile
42 lines
932 B
Batchfile
@echo off
|
|
setlocal EnableDelayedExpansion
|
|
|
|
REM Check if a version number is provided; prompt if missing
|
|
if "%~1"=="" (
|
|
echo Usage: %~nx0 [version]
|
|
set /p VERSION=Enter version:
|
|
if not defined VERSION (
|
|
echo Version cannot be empty.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
) else (
|
|
set "VERSION=%~1"
|
|
)
|
|
set "IMAGE_NAME=dify-web-rowger"
|
|
set "TAGGED_IMAGE_NAME=%IMAGE_NAME%:%VERSION%"
|
|
set "TAR_FILE_NAME=%IMAGE_NAME%.%VERSION%.tar"
|
|
|
|
REM Build the Docker image
|
|
echo Building Docker image: %TAGGED_IMAGE_NAME%
|
|
docker build -t %TAGGED_IMAGE_NAME% .
|
|
|
|
REM Check if the build was successful
|
|
if errorlevel 1 (
|
|
echo Docker build failed.
|
|
exit /b 1
|
|
)
|
|
|
|
REM Save the Docker image to a .tar file
|
|
echo Saving Docker image to %TAR_FILE_NAME%
|
|
docker save -o %TAR_FILE_NAME% %TAGGED_IMAGE_NAME%
|
|
|
|
if errorlevel 1 (
|
|
echo Docker save failed.
|
|
exit /b 1
|
|
)
|
|
|
|
echo Docker image built and saved successfully.
|
|
|
|
pause
|
|
endlocal |