-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-build
More file actions
executable file
·47 lines (34 loc) · 1.2 KB
/
docker-build
File metadata and controls
executable file
·47 lines (34 loc) · 1.2 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
#!/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
echo "Including extension package(s)"
git status --short --ignored extension/constellation-vscode-*.vsix
# Only pack files that are tracked by Git + extension packages
tar="tar c -T <(git ls-files) -T <(find extension -name constellation-vscode-*.vsix)"
elif git rev-parse --quiet --verify $revision > /dev/null; then
revision=`git rev-parse --short $revision`
echo "Build revision $revision"
vsix=$2
if [ -f "$vsix" ]; then
echo "Including extension package"
git status --short --ignored $vsix
else
echo "Second argument must be extension .vsix file"
exit 1
fi
tar="git archive $revision --prefix=extension/ --add-file=$vsix --prefix="
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}
cmd="$tar | docker build --platform amd64 --tag $name:$revision -"
echo "$cmd"
eval "$cmd"