-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·40 lines (33 loc) · 865 Bytes
/
build.sh
File metadata and controls
executable file
·40 lines (33 loc) · 865 Bytes
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
#!/bin/bash
# for debugging
BUILDARGS="--progress plain --no-cache"
# if we are on Github Actions
if [[ $CI ]]
then
DOCKERIMG=$(echo $GITHUB_REPOSITORY | tr [A-Z] [a-z])
TAG=latest
else
source init.config.txt
DOCKERIMG=$(echo $MYHUBID/$MYIMG | tr [A-Z] [a-z])
fi
# Check that the configured STATALIC is actually a file
if [[ ! -f $STATALIC ]]
then
echo "You specified $STATALIC - that is not a file"
exit 2
fi
DOCKER_BUILDKIT=1 docker build \
$BUILDARGS \
. \
--secret id=statalic,src=$STATALIC \
-t ${DOCKERIMG}:$TAG
if [[ $? == 0 ]]
then
# write out final values to config
[[ -f config.txt ]] && \rm -i config.txt
echo "# configuration created on $(date +%F_%H:%M)" | tee config.txt
for name in $(grep -Ev '^#' init.config.txt| awk -F= ' { print $1 } ')
do
echo ${name}=${!name} >> config.txt
done
fi