This repository has been archived by the owner on Jul 7, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
do.bat
81 lines (70 loc) · 1.66 KB
/
do.bat
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
@echo off
set DOCKER_CONTAINER=casa-mqtt
set version=
if "%1" == "build" goto build
if "%1" == "publish" goto publish
if "%1" == "start" goto start
if "%1" == "stop" goto stop
if "%1" == "restart" goto stop
if "%1" == "login" goto login
if "%1" == "clean" goto clean
if "%1" == "--" goto exec
goto help
:build
docker-compose build
goto:eof
:publish
if "%version%" == "" set version=%2
if "%version%" == "" set /P version=Enter a version:
if "%version%" == "" goto publish
if not "%version:~,1%" == "v" set version=v%version%
set image=roeldev/casa-mosquitto:%version%
echo You are about to push "%image%" to Docker hub.
set /P continue=Are you sure? [y/n]
if not "%continue%" == "y" goto:eof
docker push %image%
goto:eof
:start
docker-compose up -d
goto:eof
:stop
docker-compose down
if "%1" == "restart" goto start
goto:eof
:login
docker exec -it %DOCKER_CONTAINER% sh
goto:eof
:exec
set ARGS=%*
set ARGS=%ARGS:~3%
docker exec -it %DOCKER_CONTAINER% %ARGS%
goto:eof
:clean
if exist "%~dp0\config\certs" (
rmdir "%~dp0\config\certs" /s /q
)
if exist "%~dp0\config\passwd" (
del "%~dp0\config\passwd" /q
)
if exist "%~dp0\data" (
rmdir "%~dp0\data" /s /q
)
if exist "%~dp0\log" (
rmdir "%~dp0\log" /s /q
)
goto:eof
:help
echo Usage:
echo do [action]
echo do -- [command]
echo.
echo Actions:
echo build Build Docker image
echo publish Publish Docker image to Docker Hub
echo start Start Docker container
echo stop Stop Docker container
echo restart Restart Docker container
echo login Login to Docker container
echo clean Clean project; remove generated files and folders
echo -- Execute the command in the Docker container
echo.