Repository navigation
Expand file tree
/
Copy pathindocker
More file actions
executable file
·75 lines (63 loc) · 1.67 KB
/
Copy pathindocker
File metadata and controls
executable file
·75 lines (63 loc) · 1.67 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
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
#!/bin/bash
function build {
echo "building container..."
docker build -t ignite-cli -f - > /dev/null . << EOF
FROM golang:1.16.2-buster
WORKDIR /apps
RUN apt update && \
apt-get install -y \
build-essential \
ca-certificates \
unzip \
curl \
vim \
git
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs
RUN echo '\n\
alias a="cd /apps" \n\
alias s="cd /src " \n\
alias c="(cd && GLOBIGNORE='.bashrc:.cache:.config:.npm:.profile'; rm -rf *) && rm -rf /apps/*" \n\
alias i="(s && go install ./...)"' > ~/.bashrc
EOF
}
function run {
docker kill ignite-cli > /dev/null 2>&1
docker rm ignite-cli > /dev/null 2>&1
docker run \
--name ignite-cli \
-d \
-p 26657:26657 \
-p 1317:1317 \
-v $PWD:/src \
-v $PWD/apps:/apps \
ignite-cli /bin/bash -c "trap : TERM INT; sleep infinity & wait" \
> /dev/null
}
function attach {
is_running=$(docker ps -q -f status=running -f name=^/ignite-cli$)
if [[ -z $is_running ]]; then run; fi
docker exec -ti ignite-cli /bin/bash
}
case "$1" in
# build the development container.
build) build
;;
# restart the development container.
reset) run
;;
# scratch builds the container, resets existing and attachs to it.
scratch)
build
run
attach
;;
# attach to development container but start if not already running.
*) attach
;;
esac
# in container commands:
# i install Ignite CLI
# s cd into Ignite CLI's source code
# a cd into apps dir
# c cleanup previous app installations