-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.sh
executable file
·40 lines (31 loc) · 1.01 KB
/
make.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
#!/bin/bash
VERSION="1.1"
NAMESPACE='merijntjetak'
IMAGENAME='statsd'
DOCKER_REGISTRY_HOST=''
DOCKER_REGISTRY_PORT=''
# Generate docker URI
if [[ "x$DOCKER_REGISTRY_HOST" != "x" && "x$DOCKER_REGISTRY_PORT" != "x" ]]; then
DOCKER_REGISTRY_AUTHORITY="${DOCKER_REGISTRY_HOST}:${DOCKER_REGISTRY_PORT}/"
else
DOCKER_REGISTRY_AUTHORITY=''
fi
if [[ "$1" == "build" ]]; then
docker build --no-cache=true -t ${NAMESPACE}/${IMAGENAME} -t ${NAMESPACE}/${IMAGENAME}:${VERSION} .
elif [[ "$1" == "run" ]]; then
docker run \
--net=host \
${NAMESPACE}/${IMAGENAME}:${VERSION}
elif [[ "$1" == "publish" ]]; then
docker tag ${PUBLISHER}/${IMAGENAME}:${VERSION} ${DOCKER_REGISTRY_AUTHORITY}${NAMESPACE}/${IMAGENAME}:$VERSION
docker push ${DOCKER_REGISTRY_AUTHORITY}${NAMESPACE}/${IMAGENAME}:$VERSION
else
cat <<EOF
Usage: $0 action
Actions:
build - Build docker image
run - Run docker image
publish - Publish docker image
Change the parameters in the run section to adjust for local testing variables.
EOF
fi