This repository was archived by the owner on Dec 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildandrun
68 lines (54 loc) · 1.84 KB
/
buildandrun
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
#!/bin/bash
# This script should be runnable in any environment where the 'docker' command
# line will tell an engine to do things.
set -e;
docker build -t base -f base.Dockerfile .;
docker build -t build -f build.Dockerfile .;
mkdir -p build/wheelhouse;
CACHING_ARGS="$(
if [ -n "${PIP_INDEX_URL}" ]; then
echo "-e=PIP_TRUSTED_HOST=docker.for.mac.localhost -e=PIP_INDEX_URL=$(echo $PIP_INDEX_URL | sed s/127.0.0.1/docker.for.mac.localhost/g)"; # as per 'docker for mac' networking guide alias
fi;
)";
echo "$argz";
tar cjf - -X .dockerignore . | \
docker run --rm -i $CACHING_ARGS build | \
(cd build/wheelhouse; tar xjf -);
docker build -t infratwisted/lists .;
if [ -n "${DOCKER_PUSH_PASSWORD}" ]; then
docker login -u "${DOCKER_PUSH_USER}" -p "${DOCKER_PUSH_PASSWORD}";
fi;
function dvc.volname () {
# Allow for setting VOLUME_PREFIX so that we can map host paths if we want,
# for development.
local VOLUME_NAME="$1"; shift;
echo -n "${VOLUME_PREFIX:+${VOLUME_PREFIX}/}${VOLUME_NAME}";
}
if "${DEPLOYING}"; then
docker push infratwisted/lists; # XXX fixme: 'hyper load'?
if hyper fip detach lists-container; then
echo successfully detached;
else
echo detach failed;
fi;
RUNNER="hyper run --size=s4 ";
STOPPER="hyper rm -f ";
else
RUNNER="docker run";
STOPPER="docker rm -f ";
fi;
if $STOPPER lists-container; then
echo successfully stopped;
else
echo stop failed;
fi;
$RUNNER -e MAILGUN_API_KEY -e NO_RENEW --detach \
--name lists-container --restart=always \
-v "$(dvc.volname lists-tls)":/certificates \
-v "$(dvc.volname lists-database)":/database \
-v "$(dvc.volname lists-messages)":/legacy-mailman-archive \
-p 443:8443 \
infratwisted/lists;
if "${DEPLOYING}"; then
hyper fip attach 209.177.93.178 lists-container;
fi;