-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestindocker
executable file
·48 lines (45 loc) · 1.45 KB
/
testindocker
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
#!/bin/bash
set -e
make installer
(
cp capp-installer test/
cd test
DOCKER_BUILDKIT=1 docker build --network host -t capptest .
rm capp-installer
)
cat <<'EOF'
`capp` will run in a container.
You can reach the container with `docker exec -ti capptest /bin/bash`.
`tmux` is available in the container so feel free to use it.
The following ports are binded (local → container):
1022 → 22
1122 → 122
1080 → 80
1443 → 443
You can ssh with:
ssh -p 1022 root@127.0.0.1
Password is root
The server is configured to use `test.capp` as main domain.
To test your application, get the container’s IP with `IP=$(docker inspect capptest|sed -rn '/"IPAddress"/{s/.*: "(.+)",/\1/;p;q}')`
Then add temporary the IP to your `/etc/hosts` file:
IP test.capp myapp.test.capp anysubdomain.test.capp
EOF
trap 'docker kill capptest; docker rmi capptest' EXIT
docker run \
--name capptest \
--rm \
--privileged \
-p 1022:22 \
-p 1122:122 \
-p 1080:80 \
-p 1443:443 \
-d \
capptest
echo "Wait for systemd to start"
sleep 1
docker exec -t capptest /root/capp-installer test.capp mail@example.com "$@"
echo "capptest IP is $(docker inspect capptest|sed -rn '/"IPAddress"/{s/.*: "(.+)",/\1/;p;q}')"
echo "please temporarily add '$(docker inspect capptest|sed -rn '/"IPAddress"/{s/.*: "(.+)",/\1/;p;q}') test.capp myapp.test.capp' to your /etc/hosts file"
echo ""
echo "hit Ctrl-C to stop and exit"
docker logs -f capptest