-
Notifications
You must be signed in to change notification settings - Fork 162
/
Copy pathdocker.sh
executable file
·133 lines (100 loc) · 4.06 KB
/
docker.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
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
124
125
126
127
128
129
130
131
132
133
#!/bin/sh
#$ arch ====> arm64
#$ uname -m ====> arm64
#$ env /usr/bin/arch -x86_64 /bin/zsh --login
#$ arch ====> i386
#$ uname -m ====> x86_64
#$ flox activate (ideally after clearing .flox caches and manifest lock)
if [[ $(uname -m) == 'arm64' ]]; then
rm -f ./package.json.original
cp ./package.json ./package.json.original
sed 's/x64/arm64/g' ./package.json > ./package.json.new && mv ./package.json.new ./package.json
sed 's/linux-unpacked/linux-arm64-unpacked/g' ./package.json > ./package.json.new && mv ./package.json.new ./package.json
fi
docker version
docker info
# --no-cache
#--build-arg BUST_CACHE=$(date +%Y%m%d-%H%M%S)
#--build-arg BUST_CACHE=$(date +%s)
#--build-arg BUST_CACHE=`date +%s`
#--build-arg BUST_CACHE=1
if [[ $(uname -m) == 'arm64' ]]; then
docker build --platform linux/arm64 --progress=plain --build-arg BUST_CACHE=$(date +%Y%m%d-%H%M%S) -f ./Dockerfile -t thorium-docker-image .
else
docker build --platform linux/amd64 --progress=plain --build-arg BUST_CACHE=$(date +%Y%m%d-%H%M%S) -f ./Dockerfile -t thorium-docker-image .
fi
# --platform linux/x86_64
# --platform=linux/amd64
#docker image ls
#docker ps -a
(docker stop thorium-docker-container || echo ok_stop) && echo _ok_stop
#(docker kill thorium-docker-container || echo ok_kill) && echo _ok_kill
(docker rm --force thorium-docker-container || echo ok_rm) && echo _ok_rm
npm run clean
# -d
# --log-driver=none -a stdin
# --log-driver=none -a stdout -a stderr
# | xargs echo DOCKER_OUT:
# --interactive -i
# --tty -t
# -it
# --platform linux/arm64
# --publish 8888:8888
# -p 127.0.0.1:9999:9999
# --volume list
# --detach
# --rm
#
if [[ $(uname -m) == 'arm64' ]]; then
docker run --platform linux/arm64 --name thorium-docker-container thorium-docker-image
else
docker run --platform linux/amd64 --name thorium-docker-container thorium-docker-image
fi
# read -p "WAIT FOR DONE_PRESS_ENTER_KEY_NOW ..."
#docker logs -f thorium-docker-container
# docker exec -it thorium-docker-container /bin/sh
#(docker stop thorium-docker-container || echo ok_stop2) && echo _ok_stop2
#(docker kill thorium-docker-container || echo ok_kill2) && echo _ok_kill2
#(docker rm --force thorium-docker-container || echo ok_rm2) && echo _ok_rm2
# if [[ $(uname -m) == 'arm64' ]]; then
# sed 's/x64/arm64/g' ./package.json > ./package.json.new && mv ./package.json.new ./package.json
# sed 's/linux-unpacked/linux-arm64-unpacked/g' ./package.json > ./package.json.new && mv ./package.json.new ./package.json
# fi
# ??
# Thorium-2.4.0-alpha.1-arm64.AppImage
# EDRLab.ThoriumReader_2.4.0-alpha.1_arm64.deb
# Thorium-2.3.0.AppImage
# EDRLab.ThoriumReader_2.3.0_amd64.deb
# WILDCARDS GLOBS NOT SUPPORTED!
# docker cp thorium-docker-container:/THORIUM/release/*.AppImage .
# docker cp thorium-docker-container:/THORIUM/release/*.deb .
## EXEC requires a running container, whereas CP does not
# mkdir -p release || echo ok
# docker exec thorium-docker-container sh -c "tar -cf - /THORIUM/release/*.AppImage /THORIUM/release/*.deb" | tar --strip-components=2 -xf - -C release
FILENAME1=
FILENAME2=
VERSION=`cat package.json | grep 'version": ' | sed 's/ "version": "//' | sed 's/",//'`
if [[ $(uname -m) == 'arm64' ]]; then
FILENAME1="Thorium-"$VERSION"-arm64.AppImage"
FILENAME2="EDRLab.ThoriumReader_"$VERSION"_arm64.deb"
else
FILENAME1="Thorium-"$VERSION".AppImage"
FILENAME2="EDRLab.ThoriumReader_"$VERSION"_amd64.deb"
fi
echo $FILENAME1
echo $FILENAME2
mkdir -p release || echo ok
docker cp thorium-docker-container:/THORIUM/release/$FILENAME1 release
docker cp thorium-docker-container:/THORIUM/release/$FILENAME2 release
(docker stop thorium-docker-container || echo ok_stop) && echo _ok_stop
docker logs -f thorium-docker-container
docker logs thorium-docker-container
# docker exec -it thorium-docker-container /bin/sh
#(docker stop thorium-docker-container || echo ok_stop2) && echo _ok_stop2
#(docker kill thorium-docker-container || echo ok_kill2) && echo _ok_kill2
#(docker rm --force thorium-docker-container || echo ok_rm2) && echo _ok_rm2
if [[ $(uname -m) == 'arm64' ]]; then
rm -f ./package.json
mv ./package.json.original ./package.json
fi
git status