-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun-faircamp.cmd
More file actions
125 lines (99 loc) · 3.16 KB
/
run-faircamp.cmd
File metadata and controls
125 lines (99 loc) · 3.16 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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
@echo off
SET SINGLERUN=0
SET TAG=latest
:PROCESSPARAM
if "%1" == "/?" goto :USAGE
if "%1" == "-h" goto :USAGE
if "%1" == "--help" goto :USAGE
if "%1" == "-singlerun" (
set SINGLERUN=1
shift
goto :PROCESSPARAM
)
if "%1" == "" (
if "%TAG%" == "" (
set TAG=latest
)
goto :RUN
) else (
set TAG=%1
shift
goto :PROCESSPARAM
)
:USAGE
echo Usage:
echo.
echo run-faircamp.cmd [version] [-singlerun]
echo.
echo version: (optional) the Faircamp version to run.
echo -singlerun: (optional) run only once (not in a loop)
echo.
echo E.g.
echo run-faircamp.cmd 1.1
echo.
goto:EOF
:RUN
:: Disable the Docker scout messages for the pull command etc.
SET DOCKER_CLI_HINTS=false
echo.
echo _______ _______ ___ ______ _______ _______ __ __ _______
echo ^| ^| ^| ^| _ ^| ^| ^| ^| ^|_^| ^| ^|
echo ^| ___^| _ ^| ^| ^| ^|^| ^| ^| _ ^| ^| _ ^|
echo ^| ^|___^| ^|_^| ^| ^| ^|_^|^|_^| _^| ^|_^| ^| ^| ^|_^| ^|
echo ^| ___^| ^| ^| __ ^| ^| ^| ^| ^| ___^|
echo ^| ^| ^| _ ^| ^| ^| ^| ^| ^|_^| _ ^| ^|^|_^|^| ^| ^|
echo ^|___^| ^|__^| ^|__^|___^|___^| ^|_^|_______^|__^| ^|__^|_^| ^|_^|___^|
echo -- in docker -- https://github.com/n3wjack/faircamp-docker
echo.
if NOT EXIST "%cd%\data" (
echo Whoops. You do not have a .\data folder in the current folder: %cd%
echo Please create the folder, and put your Faircamp/music files in the folder. See the Faircamp manual for more information.
echo.
pause
goto :EOF
)
echo Using Faircamp version %TAG%
:PULL
:: Check if the image has been downloaded already.
docker images n3wjack/faircamp:%TAG% | findstr "n3wjack/faircamp" > nul
if %ERRORLEVEL%==0 goto :build
:: Try and pull the image.
docker pull n3wjack/faircamp:%TAG%
if NOT %ERRORLEVEL%==0 (
echo.
echo *****************************************************************************************
echo.
echo ERROR :(
echo.
echo There was an issue getting the version with tag %TAG%
echo Please check if the given version matches the tags available for the Docker image here:
echo https://hub.docker.com/repository/docker/n3wjack/faircamp/tags
echo.
echo *****************************************************************************************
echo.
goto :EOF
)
:BUILD
docker run -ti --rm n3wjack/faircamp:%TAG% --version
echo.
echo Building the Faircamp site in %cd%\data\.faircamp_build ...
echo.
docker run -ti -v %cd%\data:/data --rm n3wjack/faircamp:%TAG%
echo.
echo Building a browsable version in %cd%\data\.faircamp_build_browsable ...
echo.
docker run -ti -v %cd%\data:/data --rm n3wjack/faircamp:%TAG% --build-dir .faircamp_build_browsable --no-clean-urls
echo.
echo You can find your Faircamp site to upload in:
echo - %cd%\data\.faircamp_build
echo.
echo A browseable version can be found in:
echo - %cd%\data\.faircamp_build_browsable
echo.
start %cd%/data/.faircamp_build_browsable/index.html
if %SINGLERUN% == 1 (
goto :EOF
)
set /p response=Do you want to do another build, or stop? [y/n] :
echo.
if /I %response%==y goto :BUILD