-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-build
More file actions
executable file
·36 lines (27 loc) · 856 Bytes
/
docker-build
File metadata and controls
executable file
·36 lines (27 loc) · 856 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
#!/bin/bash
set -e
cd "$(dirname "${BASH_SOURCE[0]}")"
revision=$1
if [[ "$revision" == "--working" ]]; then
revision=`git rev-parse --quiet --short HEAD || echo 0000000`-wip
echo "Build working copy $revision"
git status --short
# Only pack files that are tracked by Git
tar="tar c -T <(git ls-files)"
elif git rev-parse --quiet --verify $revision > /dev/null; then
revision=`git rev-parse --short $revision`
echo "Build revision $revision"
tar="git archive $revision"
else
echo "First argument must be a revision or --working"
exit 1
fi
name=`git config --get remote.origin.url https://github.com/ || basename $PWD`
name=${name/https:??github.com/ghcr.io}
name=${name%.git}
for dir in delivery server
do
cmd="cd $dir ; $tar | docker build --platform amd64 --tag $name-$dir:$revision -"
echo "$cmd"
( eval "$cmd" )
done