-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdo-docker-build.sh
executable file
·52 lines (43 loc) · 1.83 KB
/
do-docker-build.sh
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
#!/bin/bash
STARTTIME=`date +'%Y%m%dT%H%M%S'`
OUTPUTDIR=./output_$STARTTIME
if [ -d ".git" ]; then
echo [`date +'%Y%m%dT%H%M%S'`] Updating local git repository.
git pull
#else
# git clone https://github.com/rdp/ffmpeg-windows-build-helpers.git
fi
docker build . -f Dockerfile -t ffmpeg-windows-build-helpers
if [ $? -eq 0 ]; then
## TODO make better so it doe snot clone everytime, but also no nested repositories. .dockerignore and self copy should also work.
#rm -rf ./ffmpeg-windows-build-helpers
mkdir -p $OUTPUTDIR
echo [`date +'%Y%m%dT%H%M%S'`] Starting container..
# When rerunning use docker start
docker run --name ffmpegbuilder -it ffmpeg-windows-build-helpers
if [ $? -eq 0 ]; then
echo [`date +'%Y%m%dT%H%M%S'`] Build successful
echo [`date +'%Y%m%dT%H%M%S'`] Extracting build artefacts...
docker cp ffmpegbuilder:/output/static/ $OUTPUTDIR
if [ $? -eq 0 ]; then
echo [`date +'%Y%m%dT%H%M%S'`] Static extraction successful. Started: $STARTTIME
else
echo [`date +'%Y%m%dT%H%M%S'`] Static extraction failed. Started: $STARTTIME
fi
docker cp ffmpegbuilder:/output/shared/ $OUTPUTDIR
if [ $? -eq 0 ]; then
echo [`date +'%Y%m%dT%H%M%S'`] Shared extraction successful. Started: $STARTTIME
else
echo [`date +'%Y%m%dT%H%M%S'`] Shared extraction failed. Started: $STARTTIME
fi
else
echo [`date +'%Y%m%dT%H%M%S'`] Build failed. Started: $STARTTIME
fi
echo [`date +'%Y%m%dT%H%M%S'`] Stopping and removing container...
docker stop ffmpegbuilder
# Comment this if you want to keep your sandbox data and rerun the container at a later time.
docker rm ffmpegbuilder
else
echo [`date +'%Y%m%dT%H%M%S'`] Docker build failed. Started: $STARTTIME
exit 1
fi