forked from d-velop/dvelop-app-template-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-build.bat
More file actions
29 lines (23 loc) · 1.15 KB
/
docker-build.bat
File metadata and controls
29 lines (23 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
@echo off
setlocal enableextensions enabledelayedexpansion
set APPNAME=acme-apptemplatejava
set BUILDCONTAINER=registry.invalid/%APPNAME%_build
set "denv="
for /f "usebackq delims=" %%a in ("environment") do (
set "denv=!denv!-e %%a=!%%a! "
)
echo Building new docker image ...
docker build -t %BUILDCONTAINER% ./buildcontainer > ./buildcontainer/build.log && (
echo done
) || (
echo error building image
exit /b 1
)
setlocal disabledelayedexpansion
if "%1"=="it" (
docker run -it --rm %denv% --mount type=bind,src=%cd%,dst=/build --mount type=volume,src=%APPNAME%_m2_repo,dst=/root/.m2/repository --entrypoint /bin/bash %BUILDCONTAINER%
rem docker run -it --rm %denv% --mount type=bind,src=%cd%,dst=/build --mount type=bind,src=%USERPROFILE%\.m2\repository,dst=/root/.m2/repository --entrypoint /bin/bash %BUILDCONTAINER%
) else (
docker run --rm %denv% --mount type=bind,src=%cd%,dst=/build --mount type=volume,src=%APPNAME%_m2_repo,dst=/root/.m2/repository %BUILDCONTAINER% %*
rem docker run --rm %denv% --mount type=bind,src=%cd%,dst=/build --mount type=bind,src=%USERPROFILE%\.m2\repository,dst=/root/.m2/repository %BUILDCONTAINER% %*
)