-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-run.sh
executable file
·50 lines (44 loc) · 1.89 KB
/
docker-run.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
#!/bin/bash
# run with this cmd:
# ./docker-run.sh wijlerenmee.be
DOMAIN_NAME=${1:-wijlerenmee.be}
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ $BRANCH == master ]
then
SUBDOMAIN=www
else
SUBDOMAIN=$BRANCH
fi
FULL_DOMAIN="${SUBDOMAIN}.${DOMAIN_NAME}"
docker build -t mondmasker:$BRANCH --build-arg vcsref=$(git rev-parse --short HEAD) --build-arg DOMAIN=$FULL_DOMAIN .
docker stop $FULL_DOMAIN && docker rm $FULL_DOMAIN
if [ $BRANCH == master ]
then
docker run -d \
--network proxy \
-l traefik.enable=true \
-l traefik.http.routers.mm-$SUBDOMAIN.entrypoints=http \
-l traefik.http.routers.mm-$SUBDOMAIN.rule="Host(\`${DOMAIN_NAME}\`, \`www.${DOMAIN_NAME}\`)" \
-l traefik.http.routers.mm-$SUBDOMAIN.middlewares=https-redirect@file \
-l traefik.http.routers.mm-$SUBDOMAIN-secure.entrypoints=https \
-l traefik.http.routers.mm-$SUBDOMAIN-secure.rule="Host(\`${DOMAIN_NAME}\`, \`www.${DOMAIN_NAME}\`)" \
-l traefik.http.routers.mm-$SUBDOMAIN-secure.tls=true \
-l traefik.http.routers.mm-$SUBDOMAIN-secure.tls.certresolver=http \
-l traefik.docker.network=proxy \
--name "${FULL_DOMAIN}" \
mondmasker:$BRANCH
else
docker run -d \
--network proxy \
-l traefik.enable=true \
-l traefik.http.routers.mm-$SUBDOMAIN.entrypoints=http \
-l traefik.http.routers.mm-$SUBDOMAIN.rule="Host(\`${FULL_DOMAIN}\`)" \
-l traefik.http.routers.mm-$SUBDOMAIN.middlewares=https-redirect@file \
-l traefik.http.routers.mm-$SUBDOMAIN-secure.entrypoints=https \
-l traefik.http.routers.mm-$SUBDOMAIN-secure.rule="Host(\`${FULL_DOMAIN}\`)" \
-l traefik.http.routers.mm-$SUBDOMAIN-secure.tls=true \
-l traefik.http.routers.mm-$SUBDOMAIN-secure.tls.certresolver=http \
-l traefik.docker.network=proxy \
--name "${FULL_DOMAIN}" \
mondmasker:$BRANCH
fi